in reply to recursive loop and performace issue in find::file

There's no need to use a while-loop around the call to find.

Also your current approach is very error-prone: it will result in an infinite loop if one of the files is not found, even if the rest of the code worked. Try this instead:

my %search_for; $search_for{$_} = 1 for @input_array; find({ wanted => \&edits}, $dir); print "Couldn't find these files: ", join(', ', keys %search_for), "\n"; sub edits { my $file = $_; if ($search_for{$file}) { print "Found $file, we were looking for it!\n"; delete $search_for{$file}; # do the copying etc. here } }