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


in reply to Directory creation in Perl using mkdir

This method uses the OS shell for checking the existance of a directory:

$dirname = 'x'; $exists = ` if [ -d '$dirname' ] ; then echo 1; else echo 0; fi `; $exists =~ s/\n$//; if ($exists eq '1') { print "exists"; } else { print "not exists"; } print "\n";

Hope this helps...