in reply to Calculating the "nearest" week

Here is a solution using Date::Calc, which could be shortened up a bit. I hard coded a range of dates to serve as an example:

use warnings; use strict; use Date::Calc qw( Week_of_Year Monday_of_Week Month_to_Text ); # Date::Calc uses 1 = Monday, ... 7 = Sunday foreach my $date ( 1 .. 20 ) { my $week = Week_of_Year( 2005, 4, $date ); # see docs for caveats my ( $year, $month, $day ) = Monday_of_Week( $week, 2005 ); print "The Monday before April $date was ", Month_to_Text( $month ), " $day\n"; }

Output:

The Monday before April 1 was March 28 The Monday before April 2 was March 28 The Monday before April 3 was March 28 The Monday before April 4 was April 4 The Monday before April 5 was April 4 The Monday before April 6 was April 4 The Monday before April 7 was April 4 The Monday before April 8 was April 4 The Monday before April 9 was April 4 The Monday before April 10 was April 4 The Monday before April 11 was April 11 The Monday before April 12 was April 11 The Monday before April 13 was April 11 The Monday before April 14 was April 11 The Monday before April 15 was April 11 The Monday before April 16 was April 11 The Monday before April 17 was April 11 The Monday before April 18 was April 18 The Monday before April 19 was April 18 The Monday before April 20 was April 18

Once you know the starting date, it is trivial to calculate the rest. :)

HTH