in reply to Re^2: directory exists
in thread directory exists

Yes. I'd use a test like this in real code, and I guess it got into my recommendation:

is_dir { -e shift() ? -d _ ? 1 : 0 : undef; }
With that I can test truth to see if there is a directory of that name, or defined to see if the name is in use.

After Compline,
Zaxo

Replies are listed 'Best First'.
Re^4: directory exists
by ambrus (Abbot) on Jun 03, 2005 at 19:01 UTC

    Even that's redundant. The -d function by itself DWYM, and returns undef if the stat fails, false if the file exists but is not a directory.