http://www.perlmonks.org?node_id=168877


in reply to Problems with -filetest on readdir results

readdir doesn't prepend the path information, you need to do it yourself.
something like :
print "$_ \n" if (-d $path.$_);
should do you. This assumes that $path has the appropriate directory separator on the end.