in reply to mkpath()

(Added for reference for googlers) mkpath is legacy, try make_path, works as you wanted.
use File::Path qw(make_path) make_path("/var/tmp/log/script/",{mode => 0777});