# 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 ); #### Not enough arguments for grep at test.pl.txt line 30, near "@_ }" Execution of test.pl.txt aborted due to compilation errors.