in reply to While loop
That works. It'll echo every value entered, which you didn't ask for, but it will also prompt for "yes" or "no" after every 'incorrect' input. Why patterns instead of eq? Easier to customize, IMO, in case you want to allow for different case (with the /i, as above), or just allow for 'y' or 'n,' or whatever. HTHmy $input = ''; until (($input =~ /^yes/i) or ($input =~ /^no/i)) { print "Please Enter Yes or No: \n"; chomp($input = <>); printf "'%s' entered for system\n", $input;
|
---|