my @files = <*.txt>; #### { local @ARGV = <*.txt>; while( <> ) { // $_ contains the lines of the files one at a time; for each file in turn } } #### { local @ARGV = <*.txt>; while( <> ) { chomp; print $ARGV, '(', $., '):', $_; } }