$ perl script.pl data.dat #### $ cat data.dat | perl script.pl #### while (<>) { ... # code for each line } #### unshift(@ARGV, '-') unless @ARGV; while ($ARGV = shift) { open(ARGV, $ARGV); while () { ... # code for each line } }