use warnings; use strict; use File::Find; my $dir = '/full/path'; my %fullpath; my @toget = qw/foo goo moo/; #my $pattern = join "|",@words; # bad mistake on my part my $pattern = join "|",@toget; find sub { $fullpath{$_} = $File::Find::name if -f $File::Find::name; },$dir; for (keys %fullpath) { print $fullpath{$_}; if (/($pattern)/i) { print "\t$1\n" } else {print "\tNO MATCH\n";} }