I tested with:
find(\&wanted, "/usr/home/amarquis");
sub wanted {
print $File::Find::name . "\n";
if ($File::Find::dir =~ /images/) {
$File::Find::prune = 1;
}
}
And indeed it continued to call wanted for files in "images" but did not go into subdirectories. But since you already have in place a check to see if you want to prune a directory, why not extend that check to before you process a file? For example:
sub wanted {
# Prune this directory so we don't recurse farther,
# And return so we don't process this file.
if ($File::Find::dir =~ /images/) {
$File::Find::prune = 1;
return;
}
# Now we can do our processing:
print $File::Find::name . "\n";
}