in reply to How to determine whether a dir entry is a directory?

You can use -d, but you have to be sure you're testing the correct pathname. Note that readdir returns unqualified names relative to the directory they're in.
my $dir = "/anydir"; opendir DIR, $dir or die "opendir $dir : $! \n"; for ( readdir DIR ) { my $dirent = "$dir/$_"; if ( -d $dirent ) { print "$dirent is a directory\n"; } } closedir DIR;