foreach my $file (<*.txt>) { open(FILE,"< $file") or die "Cannot open $file - $!\n"; # Read in from FILE and do stuff with it... } #### @ARGV = <*.txt>; while (<>) { # Files will now be opened and read automagically, and # each line placed in $_. You can see which file # you're currently reading from by looking at $ARGV. }