eval {mkpath (['/foo/bar/baz', 'blurf/quux'])}; if ($@) { ... it failed ... }