But your input is stored into $input2 which is checked against a number (you don't need the 'int 1' bit, it can be just 1). Then you have a conditional:
if($input2 ne NULL || $input2 ne " ")
At this point $input2 has not been reset by new user input. So if they choose anything, $input2 will most definitely be ne " ". Which means you recursively call your choice subroutine. (Hint: This really isn't what you want)
So you need to clean things up a bit. I'd suggest something like the following pseudo-code:
good_input = 0; while (not good_input) { display menu get user input if user input == 1 do stuff for choice one set good_input true elsif user input == 2 do stuff for choice two set good_input true # continue processing choices with elsif, # but the last bit should be the default # case: else display error message }
This is simplistic in its approach, I'm sure other monks have a better idea or style. But it's fairly easy to understand, I think.
Also, as Joost suggested, do some cleanup of the code with perltidy. On top of that, you could narrow down the scope of future questions -- find what it is that's going wrong, and write the shortest code snippet you can to illustrate the problem. You already know the basic area -- it's running into an infinite loop on the choice menu.
In reply to Re: Adding a Users data
by Nkuvu
in thread Adding a Users data
by Snowman11
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |