in reply to Re: Procesing directories
in thread Procesing directories

I think more than localizing the dir handle is needed to get it to work.
Fastolfe already gave the best answer.
Now some other trouble with the original code
if ($tmp =~ /\.\.?/) { next; }
This will skip any file with one or two periods. This might cause trouble at the mill.
$tmp = "$dir/$tmp"; if ($tmp =~ /^(\w*)\.(jpg|jpeg)$/)
\w will only match letters and _. You put a / in.