See File::Path::mkpath, and also perlfunc for the -d and -e operators.
In reply to Re: detecting directory in perl by Corion in thread detecting directory in perl by Anonymous Monk