#Note this is windows centric use strict; make_dir("c\:\\this\\is\\a\\deep\\subdirectory\\"); sub make_dir { my ($inpath) = @_; #Full directory path my $path = ""; #Storage path #Loop through the sections foreach(split/\\/,$inpath) { #Add to path $path .= $_ . "\\"; #Elimnate the drive and check to see if path exists if(!/\:/ and !-e $path) { #If not then make it mkdir $path; #Show status for demo print "Makeing $path\n"; } } }