Ok so I've set it so that Perl will flush after every write.
I've also added another loop in split_logfile() to close every
file (perhaps it wasn't finished writing to the files before it
moved on to gen_stats()?). But, this has no effect. I still have
several random files that are zero length, as if the log entries
are not being written at all. Oddly enough, there are several
files that appear to be written correctly. I just don't get it...