use strict; use warnings; my $isover; #using strict requires variables declaration with 'my'. my $totalguesses; my $reply; until ($isover) { clear_the_screen(); print "Find the secret number between 1 and 100: \n\n"; LABELED: print "Enter your guess: \n\n % "; #labeling a position my $userguess; chomp($userguess = ); while ($userguess !~ /^[+-]?\d+$/ ) { print "\nYour guess must be a number. Try again. \n\n"; goto LABELED; } $totalguesses++; my $secretnumber=100; if ($userguess == $secretnumber) { clear_the_screen(); print "You guessed it! Press to return to the Main Menu.\n\n"; chomp($reply = ); $isover = 1; #Defines $isover hence the evaluation would return true #the until(){} block would exit then... }elsif ($userguess > 100) { print "\nYou chose a number higher than 100. to try again.\n"; chomp($reply = ); }elsif ($userguess < $secretnumber) { clear_the_screen(); print "$userguess is too low. Press to guess again.\n\n"; chomp($reply = ); }elsif ($userguess > $secretnumber) { clear_the_screen(); print "$userguess is too high. Press to guess again.\n\n"; chomp($reply = ); } } print "your guesses $totalguesses\n"; sub clear_the_screen{ }