Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: typo? variable misteriously becoming undef

by elusion (Curate)
on Nov 14, 2002 at 20:10 UTC ( [id://212999]=note: print w/replies, xml ) Need Help??


in reply to typo? variable misteriously becoming undef

You've forgotten your elsif!

You are using many different if statements, so you can go through more than one. This is important because if your else statement.

$response is tested to be equal to be 2,3,4, and 5, at which point, you have action, and your value's printed. Then it continues to be tested for 6,7,8,9, and 1. After the one, you have an else. Since response equals 5 and not 1, the else is executed, shifting the array again.

Change all the ifs but the first in the series to elsifs, and it should work. ;-)

elusion : http://matt.diephouse.com

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-04-19 05:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found