in reply to Re: Better way to search?
in thread Better way to search?

If you really wanted to do away with "bloat", you could condense chromatic's example further ...

sub wanted { print "$File::Find::dir/$hold\n" if /\.(\w+)$/ and exists $exts{ lc $1 }; }

... which reads a little more natural (at least to me :-)).

You might also consider adding a small snippet of code so directories with multiple matches are only printed once instead of once per match.

my %already_seen; sub wanted { print "$File::Find::dir/$hold\n" if /\.(\w+)$/ and exists $exts{ lc $1 } and not $already_seen{ $File::Find::dir }++; }

    --k.