Life with ‘autodie’ 

{
    use autodie;

    mkdir($path);
    chdir($path);
    open(my $fh, '>', $file);
}

# Exceptions stringify nicely, e.g.:
#
# Can't open '/fnurk/blurk/spurk' for writing: 'No such file
# or directory' at ./ptst line 10