in reply to Repeat question
One pattern you can apply for that kind of thing is:
my $answer = 42; while (1) { print "What is the answer? "; chomp( my $input = <STDIN> ); if ( $input == $answer ) { print "Good!\n"; last; # break out of innermost loop } else { print "Please try again.\n"; } }
|
|---|