in reply to Re: Guess That Number
in thread Guess That Number

The change you gave me jdporter worked fine...but now when I try to change the d to a D it keeps giving me Please enter a number only...
# jdporter's change...worked fine my $goal = int(rand($high-$low+1))+$low; while (1) { print "Enter a number between $low and $high: "; #The answer from the user my $answer = <STDIN>; chomp($answer); # when I change the d to a D I get "Please enter a number only" if ($answer !~ /\d+/) { print "Please enter a number only\n"; next;
The early bird gets the worm but the second mouse gets the cheese.
pretendeavor

Replies are listed 'Best First'.
Re^3: Guess That Number
by jdporter (Paladin) on Jul 09, 2009 at 19:29 UTC

    Please do not ignore BioLion's reply, below. He is correct, as is toolic. You are not looking closely enough. Could be Perl's fault for being so cryptic and terse, or it could be your fault for making assumptions about what the code is doing.