Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: typo? variable misteriously becoming undef

by elusion (Curate)
on Nov 14, 2002 at 20:10 UTC ( #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
Node Status?
node history
Node Type: note [id://212999]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2019-07-19 01:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?