in reply to Re^2: Why can't I open a file for writing?
in thread Why can't I open a file for writing?

If you use || instead of or then you need parentheses for the open function:

open( NEWFILE, '>', "$dir/subdirectory/$outputfile" ) || die "Can't +open $dir/subdirectory/$output