Guest User

Untitled

a guest
Jun 24th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. #!/usr/bin/perl -w
  2. #Jason Piper
  3.  
  4. $randnum = int( rand 10 );
  5.  
  6. print "I'm thinking of a number between one and 10\n";
  7.  
  8. ask: {
  9. print "Your guess is... ";
  10. $guess = <STDIN>;
  11. chomp($guess);
  12. }
  13.  
  14. if ( $guess > $randnum ) {
  15. print "You guessed too high!\n";
  16. goto ("ask");
  17. } elsif ($guess < $randnum) {
  18. print "You guessed too low!\n";
  19. goto ("ask");
  20. } else {
  21. print "You guessed $guess correctly!\n";
  22. }
Add Comment
Please, Sign In to add comment