$path = "/path/to/real/deep/folder"; $out = `mkdir -p $path 2>&1`; die "Can't make path: $out\n" if ($? > 0);