Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Control Structure problem, mistake can't be found

by broomduster (Priest)
on Aug 23, 2008 at 00:21 UTC ( [id://706348]=note: print w/replies, xml ) Need Help??


in reply to Control Structure problem, mistake can't be found

One more tip for how to debug this kind of thing....

After you set $guess (whether you read it from STDIN or not), but before the line

if ($guess eq $correct[$i])
you can see what the value of $guess is by doing
print "[$guess]";
Note the square brackets ( [ and ] ). They are important here because they show where the value starts and ends. So if the value of $guess is Yellow\n, you get
[Yellow ]
and you see clearly that you have a \n at the end (which you may not want).

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2024-04-19 08:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found