Please not only turn warnings on, but check the error log
for your CGI scripts, (if you can't do that, redirect
STDERR to some place you can check.) Your script should produce the warning:
Filehandle IN opened only for output... which is exactly your problem.
Additionally the File::Copy standard module is much
better for this task.
Also, why aren't you using -T?