while(1) { if (eof(STDIN)) { print "END"; exit; } $_ = ; if (/^q/i) { print "END"; exit; } print; print '$ '; }