in reply to Timestamp of last monday

Currently your code looks like this :
my ($sec,$min,$hour,$mday,$mon,$year, $wday,$yday,$isdst)=localtime(time);

The time keyword returns an integer value of seconds since epoch... if you decrement that value before sending it to localtime you can return any date/time you want. I.e :

my $week_of_seconds = 60 * 60 * 24 * 7; my $current_time = time(); my $week_ago = $current_time - $week_of_seconds; my ($sec,$min,$hour,$mday,$mon,$year, $wday,$yday,$isdst)=localtime($week_ago);

The above isn't tested because I can't be bothered, the solution looks more or less like that, play around with it.