my $line; while ( (print "list of letters: "),$line=<>, $line !~ /\s*quit|exit|q\s*$/i) {..do something with this line...}