eval { mkpath($newdir, 0, 0755) }; if ($@) { print "can’t mkdir $newdir: $@"; }