Other ways would involve possibly a subroutine or hacking about with a while loop:TOP: my $num = <STDIN>; if( $num != 10 and $num != 0 ) #ok, a horrible condition { goto TOP; } #rest of code
my $input; while( $input != "good" ) { print "Please enter number:\n"; $input = <STDIN>; } #rest of code
In reply to Re: restart program on wrong user input.
by BUU
in thread restart program on wrong user input.
by BioGeek
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |