my %files = map {$_ => undef} qw(data.txt scripts.pl); find(sub { $files{$_} ||= $File::Find::name if exists $files{$_}; }, $location); for my $file (keys %files) { print $files{$file} ? "$file found in $files{$file}\n" : "$file not found\n"; }