opendir(my $dh, "/tmp/files"); my @files=readdir($dh); closedir $dh; my $index = 0; $index++ until $files[$index] eq "."; splice(@files, $index, 1); $index++ until $files[$index] eq '..'; splice(@files, $index, 1); foreach my $file ( @files ) { print "\n\nThe File is $file\n\n"; open (MYFILE, "<$file") or die $! ; while () { chomp; if ( $_ =~ m/map/i ) { print "$_ in $file\n"; } } close (MYFILE); } Error [root@r01mgt functionaltest]# perl checkfunctional.pl The File is mrbench_result No such file or directory at checkfunctional.pl line 22.