in reply to Getting deep with mkdir

use File::Path;
mkpath('/some/nonexistant/path');

It's part of the perl core and it will do the right thing for making paths when some or all of the path is non-existant.