Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with a program written in perl
#1
The following is a program written in perl about guessing a number. I need to add a win or loss reporting feature.

#!/usr/bin/perl
# guessnum.plx
use warnings;
use strict;
my $target = 12;
print "Guess my number!\n";
print "Enter your guess: ";
my $guess = <STDIN>;
if ($target == $guess) {
print "That's it! You guessed correctly!\n";
exit;
}
if ($guess > $target) {
print "Your number is bigger than my number\n";
exit;
}
if ($guess < $target){
print "Your number is less than my number\n";
exit;
}
Reply


Messages In This Thread
Help with a program written in perl - by Rodman42866 - 03-06-2012, 08:39 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Compile Error in Perl liveproject101 0 1,303 04-12-2013, 03:08 AM
Last Post: liveproject101
  [Perl] IRC Bot wchar_t 26 14,583 08-20-2012, 01:40 PM
Last Post: Trump
  Perl Ebook ven0m 2 1,829 05-04-2012, 08:14 AM
Last Post: ven0m
  HTML perl script AceInfinity 5 2,729 12-03-2011, 11:35 PM
Last Post: Closed Account
  Perl ARGV Tutorial AceInfinity 0 2,404 08-22-2011, 02:30 PM
Last Post: AceInfinity

Forum Jump:


Users browsing this thread: 2 Guest(s)