1 until ($isover) { 2 clear_the_screen(); 3 print "Find the secret number between 1 and 100: \n\n"; 4 #print "Enter your guess: \n\n > "; ">" in book's script; why? 5 chomp($userguess = ); 6 7 #following "while" loop added by me in a "challenge" 8 while ($userguess !~ /^[+-]?\d+$/ ) { #testing to see whether user entry is a number 9 print "\nYour guess must be a number. Try again. \n\n"; 10 print "-->"; 11 chomp($userguess = ); 12 13 } 14 15 $totalguesses++; 16 17 if ($userguess == $secretnumber) { 18 clear_the_screen(); 19 print "You guessed it! Press to return to the Main Menu.\n\n"; 20 chomp($reply = ); 21 $isover = 1; #terminates current game and returns to main menu 22 23 #first "elsif" block added by me in a "challenge" 24 } elsif ($userguess > 100) { 25 print "\n\nYou chose a number higher than 100. Press to try again. \n\n"; 26 chomp($reply = ); 27 28 } elsif ($userguess <= $secretnumber) { 29 clear_the_screen(); 30 print "$userguess is too low. Press to guess again.\n\n"; 31 chomp($reply = ); 32 33 } elsif ($userguess >= $secretnumber) { 34 clear_the_screen(); 35 print "$userguess is too high. Press to guess again.\n\n"; 36 chomp($reply = ); 37 } 38 } 38 39 return $totalguesses;