Just another Perl shrine | |
PerlMonks |
Re: typo? variable misteriously becoming undefby elusion (Curate) |
on Nov 14, 2002 at 20:10 UTC ( [id://212999]=note: print w/replies, xml ) | Need Help?? |
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
In Section
Seekers of Perl Wisdom
|
|