in reply to Re: Get Filename using perl
in thread Get Filename using perl

grep and glob are often very useful, for example:

my $dir = '.'; my $match = 'perl'; my @files = grep { -f } glob ( "$dir/*" ); for my $file(@files) { open my $fh, $file or next; print "Found match in $file\n" if grep{ /\Q$match\E/ }<$fh>; }

cheers

tachyon