in reply to Reading all files in a directory with one filehandle

Just using glob should work, shouldn't cause an error:
foreach my $file ( glob('/tmp/files/*') ) { print "\n\nThe File is $file\n\n"; open (MYFILE, "<$file") or die $! ; while (<MYFILE>) { chomp; if ( $_ =~ m/map/i ) { print "$_ in $file\n"; } } close (MYFILE); }