The
File::Path module is another helpful tool in the programmers arsenal to skin such a cat.
Remember to use
oct() in conjunction with your
mkpath() if you have a custom mask you want to use that is set in a scalar value elsewhere, lest you get oddly (perhaps inaccessibly) permissioned directories as a result.