in reply to While loop

as a one-liner:

$ perl -Mstrict -w -e'while(1){ chomp( my $i = <STDIN>); $i eq "yes" & +& print "yes" && last; $i eq "no" && print "no" && last }'
as legible code:

#!/usr/bin/perl -w use strict; $|++; while(1) { chomp( my $i = <STDIN> ); if( $i eq 'yes' ) { print "Yes entered for system.\n"; last } if( $i eq 'no' ) { print "No entered for system.\n"; last } }
it's an infinite loop--the only way to exit is to enter a valid response.

aw, heck, there's more than one way to do it...

my $response = qr/^(yes|no)$/; while( chomp( $_ = <STDIN> ) ) { /$response/ and print "$1 entered for system.$/" and last }

~Particle *accelerates*