BTW, you shouldn't use <$file> and print if you are just copying the file. Especially if the file is a binary file. You set binmode which is good so it won't change end-of-line characters. But copying line-by-line is slower because the input must be scanned for end-of-line characters. If you just want to copy the file, use read and print with a fixed buffer size as large as you can get away with.
while ($bytesread=read($filename,$buffer,1024)) {
print OUTFILE $buffer;
}
(Code is from the CGI man page).