Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

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

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


in reply to Re^2: Control Structure problem, mistake can't be found
in thread Control Structure problem, mistake can't be found

Your problem is here:
$i++; if ($guess eq $correct[$i]) { # if guess is correct, reply
Array indices in Perl start with 0. You are incrementing $i before you use it as an index to check the first answer. So the "correct" answer to the first question you ask should be "Moonlight Mile" ... ;-)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2024-04-25 12:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found