my ($getch); while (1) { print "Enter a something: "; $getch = getc; print "\n\n$getch\n\n"; exit if ($getch =~ /^q/); }