Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^2: Guess That Number

by naildownx (Beadle)
on Jul 09, 2009 at 19:24 UTC ( [id://778672]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://778672]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (7)
As of 2024-04-23 10:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found