in reply to Perl Matching Question

While debugging throw lots of print's in and try things out.   That would tell you that $file is going to be just the filename within the directory, not the whole path you need in your open(FILE,....   But then you forgot the or die which would tell you the same thing.
opendir(DIR, $some_dir) || die "can't opendir '$some_dir': $!"; while ($file = readdir(<DIR>)) { if ($file =~ /Somthing/){ my $fullpath = "$some_dir/$file"; open(FILE, $fullpath) or die "can't open file '$fullpath' for + reading: $!"; while(<>) { if( m/PASS/ ) { print $_; } } # look around ... I'm sure you can find examples # of reading files line by line close(FILE); } close(DIR);