foreach my $file (<*.txt>) { open(FILE,"< $file") or die "Cannot open $file - $!\n"; # Read in from FILE and do stuff with it... }