in reply to detecting directory in perl

See File::Path::mkpath, and also perlfunc for the -d and -e operators.