in reply to Date::Calc Question

once it is running it goes or runs forever
I assume your logs are pretty big. The prime culprit is probably the keep_line subroutine; move the open TEMP to before the open FILE, the close TEMP to just after the unlink $filename, and change the calls to keep_line to do the print TEMP $line.

Another suggestion: ditch everything that uses @log_lines and just open ARCH before the foreach $filename and do the print ARCH $line instead of pushing to @log_lines.