Life before ‘autodie’ 

mkdir($path)
    or die "Can't create directory $path: $!";

chdir($path)
    or die "Can't chdir into $path: $!";

open(my $fh, '>', $file)
    or die "Can't create file $file for writing: $!";