There is no loop block here for redo to operate on - I am surprised it doesn't give an error actually. You should place make your outer block a loop like:
#!/usr/bin/perl -w use strict; my $input = 0; START: while($input != 7 ) { menu(); chomp($input = <STDIN>); if ($input == 1) { print "You have chosen option 1\n"; next START; } if($input == 2) { print "You have chosen option 2\n"; next START; } if ($input == 3) { print "You have chosen option 3\n"; next START; } if($input == 4) { print "You have chosen option 4\n"; next START; } if ($input == 5) { print "You have chosen option 5\n"; next START; } if($input == 6) { print "You have chosen option 6\n"; next START; } else { last START; } } # omitted sub ...
Also bear in mind that nice indentation is next to godliness :)
/J\
In reply to Re: simple menu loop problems
by gellyfish
in thread simple menu loop problems
by ddrumguy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |