my $args= @ARGV; if( ! eof() # Prime the <> pump && @ARGV == $args-1 # Did we not move past the first file? ) { while( <> ) { print "First: $_"; last if eof; } } while( <> ) { print; }