immediate thoughts (maybe not directly on track, but hopefully helpful):
if you use warnings; and use strict;, does anything pop?
(not sure if it's an issue--maybe 'use warnings' will indicate it if it is) something w/the scope of LOG and the sub's being declared inside the loop (i think that's ok, but caught my attention right away)?
maybe use one of the many loggers on CPAN such as Log::Log4Perl?