[denzil_cactus]: unless(-d $dir){ `mkdir $dir`;}is this code correct if I want to check the directory exists or not? [moritz]: use if (-d $dir) [ysth]: no, the -d could fail if you don't have access (but then you probably wouldn't be able to do the mkdir either [ysth]: and use perl's mkdir, not the shell [ysth]: mkdir [ysth]: err, I mean the -d could fail but the directory already exist [moritz]: yes, then use -e instead [moritz]: or whatever test you're feeling lucky with ;-) [ysth]: if you may need to create multiple levels of directory (say, create foo/bar/baz where only foo exists), use File::Path::mkpath (in an eval {} )