in reply to Re: Ignoring a Directory with File::Find
in thread Ignoring a Directory with File::Find
but I'm getting the error:# Build a Regex my $rexstr=join'|',map {quotemeta $_} @exts; my $rex=qr/(?:$rexstr)$/i; # Directory to Ignore my $dir = qr/pics/i; my @list; # Find the files find({ wanted =>sub{ print "Found a match: $_\n" if /$rex/; push @list,$_ if /$rex/} , no_chdir => 1, preprocess => sub { grep not /$dir/ => @_ }, }, $search_root );
I think my syntax is correct. I did end up taking John M. Dlugosz and FamousLongAgo suggestion and use a blank return statement instead and I got it to do what I want. I'm still curious about this preprocess function though. I could not find any mention to it in the File::Find docs. nor in perlsub Where can I read more on this function?Not enough arguments for grep at test.pl.txt line 30, near "@_ }" Execution of test.pl.txt aborted due to compilation errors.
|
|---|