http://www.perlmonks.org?node_id=1207169


in reply to Why can't I open a file for writing?

Perhaps the bitwise or (|)?

open NEWFILE, '>', "$dir/subdirectory/$outputfile" | die "Can't open + $dir/subdirectory/$output here-^
Try or or || instead.