# nasty.pl use strict; use warnings; $| = 1; print 'first line: ', scalar <>; while (<>) { print "first loop: $_"; } while () { print "second loop: $_"; } __END__ #### % echo 'just another one-line file' > one-line_file % yes junk | head -3 | perl nasty.pl one-line_file first line: just another one-line file second loop: junk second loop: junk second loop: junk