Mikal's Perl doesn't look much like line noise, so I thought I'd set it straight. I've also renamed rmkdir to pmkdir, so it looks less like rmdir

sub pmkdir($)
{
        my $x;
        $x .= "$_/", -d $x or mkdir $x for grep {$_ ne ''} split '/', shift;
}

Update: do -d checking in the correct place.