We tried moving the log files to a completely different directory structure and the script worked flawlessly. It has to be something in the directory set up, or something system-level. The Perl script is fine. I'll gladly take this as an answer after all the frustration and fruitless searching. :)