in reply to Continure when "y" and none for "n"
Something like the following would work:
my $choice; while (1) { print "\nDo you want to continue : "; chomp($choice = <STDIN>); if ($choice eq "y" || $choice eq "n") { last; } else { print "\nERROR:Invalid Choice\n"; } }
Note: use eq and ne for string comparison. == and != are used for numerical comparisons
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Continure when "y" and none for "n"
by Anonymous Monk on Apr 29, 2011 at 14:10 UTC |