Can someone tell me why I am getting the following error? Global symbol "$quess" requires explicit package name at ./ex10-1.pl line 18. Execution of ./ex10-1.pl aborted due to compilation errors.
I declare $guess inside the while loop. Shouldn't that suffice for the rest of the scope? Thank you, Chris #!/usr/bin/perl use warnings; use strict; my $secret = int(1 + rand 100); # This next line may be uncommented during debugging print "Don't tell anyone, but the secret number is $secret\n"; while (1) { print "Please enter a guess from 1 to 100: "; chomp(my $guess = <STDIN>); if ($guess =~ /quit|exit|^\s*$/i) { print "Sorry you gave up. The number was $secret.\n"; last; } elsif ($guess < $secret) { print "Too small. Try again!\n"; } elsif ($quess == $secret) { print "That was it!\n"; last; } else { print "Too large. Try agian!\n"; } } -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/