Update: fixed a small error.my @acceptable = ('good', 'bad', 'iffy'); while(<>) { chomp; my $input = $_; foreach (@acceptable) { next unless $_ eq $input; print "You are feeling $_!"; undef $input; last; } unless( $input) { print "You didn't give an acceptable answer! Try again:\n"; } }
In reply to Re: A better understanding of while () loops
by psychotic
in thread A better understanding of while () loops
by sub_chick
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |