in reply to Re: another directory question
in thread another directory question

Depeding on how long you intend to spend doing stuff in each directory, it might be a good idea to do a chdir into that directory. This would avoid running into problems like the one you just had.

This is one of those philosofical issues, like what's best: Each person has a particular way of doing things, but I just tend to think its a matter of what makes things clearer. In your case, it could be:
if (-f "$path/$leaf") { } # or simply chdir($path) || warn(); if (-d $leaf) { }
cheers!