while ($answer <= 9) { if ($answer eq $numbers[$i]) { $answer = $words[$i]; $i++; $answer; } else { #print $answer; } # end if } # end while
Well, $answer here is a word like "eight", and the problem with the loop condition is that you cannot numerically compare "eight" to 9.
OK, let me give you a hint: When the user inputs 8, you want to print $words[7], don't you? Notice that 7 is 8-1? ;)
In reply to Re: Sub Routine Malfunction
by betterworld
in thread Sub Routine Malfunction
by koolgirl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |