http://qs1969.pair.com?node_id=171772


in reply to -d fails outside the current working directory

As you see, readdir returns the unqualified names of the directory entries, but -d operates on them within the context of the current working directory, which is a recipe for failure. You should either change your cwd (not really recommended), or prepend the filenames with the relative/absolute path, as in:
print "\nOnly directories:\n", grep { -d "$ARGV[0]/$_" } readdir(DIR);
   MeowChow                                   
               s aamecha.s a..a\u$&owag.print