Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl -w
- #Jason Piper
- $randnum = int( rand 10 );
- print "I'm thinking of a number between one and 10\n";
- ask: {
- print "Your guess is... ";
- $guess = <STDIN>;
- chomp($guess);
- }
- if ( $guess > $randnum ) {
- print "You guessed too high!\n";
- goto ("ask");
- } elsif ($guess < $randnum) {
- print "You guessed too low!\n";
- goto ("ask");
- } else {
- print "You guessed $guess correctly!\n";
- }
Add Comment
Please, Sign In to add comment