in reply to CGI troubles - not writing to file

Stumped here too, but some technical critique: rather than rolling your own error reporting routine use CGI::Carp; - and during development but not on the production machine, use CGI::Carp qw(fatalsToBrowser); which will report you the death message. Then in the script just die "Error here"; - that's what die is for after all. In your case, the exit(0); prevents the die from happening.

Also, I'm almost sure it won't solve anything, but I recommend you use File::Copy over rolling your own copying function as it knows how to handle a great number of fringe conditions.

Makeshifts last the longest.