sub my_mkdir { my ($path, $perms) = @_; my $dir = '.'; for ( split /\//, $path ) { mkdir $dir .= "/$_", $perms; } }