in reply to End of Month Conversions For Date

It sounds like you're doing log rotation, in which case you could probably make use of a simple fact: you want to keep around the last 7 days of log entries. So keep each day's log entries in separate files, and just keep the 7 most recent. Here's a really simple log rotation script (it's written for Apache log files, but there's nothing specific in it that you couldn't adapt to your purposes). Try it out--then you won't have to mess around with all that date arithmetic.

If you must, though, my advice would be to convert the times into epoch seconds using Time::Local, then compare them thusly.

use Time::Local; my $epoch_seconds = timelocal($sec, $min, $hour, $mday, $mon, $year);