in reply to
are you chomping $line? Does your script have access to those files? Remember access permissions for CGI scripts can be pretty strict. Check to see if permissions for those files are correct if you are sure the directory permissions are correct. Print the HTTP header ASAP (I mean at the top of the file, after the shebang) and altho CGI might seem overkill here (because of the huge size), there are ways to only load the header and there's nothing like a good habbit to keep your code from turning buggy.
...Perl is like sex: if you're doing it wrong, there's no fun to it.