use File::Path; mkpath($dir); -d $dir or die("Could not create ($dir)\n");