use Time::ParseDate; # ... # use some logic to find beginning of last week # note: (localtime)[6] = wday (0-6) where 0 = Sunday my($today) = (localtime)[6]; my($monday_lastw) = { # figure out days since monday of last week 0 => 6, 1 => 7, 2 => 8, 3 => 9, 4 => 10, 5 => 11, 6 => 12, }->{ $today }; my($saturday_lastw) = $monday_lastw - 6; # (days since sat. of last wk) # get unix timestamp of the date on /monday/ of last week # (first second of last week) push(@parms, (parsedate(qq{$monday_lastw days ago 00:00:00}))[0]); # get unix timestamp of the date on /saturday/ of last week # (last second of last week) push(@parms, (parsedate(qq{$saturday_lastw days ago 23:59:59}))[0]);