Greetings Monks,
I am using File::Find in a loop to recursively search a list of direcories and grep the found files for a specific pattern. I can print out the matching files, but what I really want to do is store a the list in an array. Here's what I've done so far:
sub findstuff {
my $file = $File::Find::name;
return unless -f "$file";
if (fgrep { /regex/ } "$file") {
print "Found regex in $file\n";
}
}
foreach (@dirs) {
find(\@findstuff, $_);
}
How can I get list of matching files into an array inside of the foreach loop?
Thanks!