in reply to Re: File::Find: Return array of "wanted" files (File::Find::Rule)
in thread File::Find: Return array of "wanted" files

AFAIK, the OP wanted to apply the regex to the contents of the files, not the names, so it should be:

my @files = File::Find::Rule->grep( qr/regex/ )->in( @dirs );
  • Comment on Re^2: File::Find: Return array of "wanted" files (File::Find::Rule)
  • Download Code

Replies are listed 'Best First'.
Re^3: File::Find: Return array of "wanted" files (File::Find::Rule)
by Anonymous Monk on Oct 04, 2013 at 08:30 UTC

    AFAIK, the OP wanted to apply the regex to the contents of the files, not the names, so it should be:

    Go figure, I thought it was a typo, oh well :)

    use File::Find::Rule qw/ find /;
    my @files = find( file => grep => qr/regex/, in => \@dirs, );

      Thanks, File::Find::Rules works great.