I am looking for a Perl script which can give me the last Monday for any specified date.
e.g. For date 2011-06-11, the script should return 2011-06-06
In the spirit of Perl, There Is More Than One Way To Do It.
use Modern::Perl; use Date::Calc qw/Day_of_Week/; my $date = '2011/6/11'; my @fields = split /\//, $date; my @new_date = Add_Delta_Days( @fields , 1 - Day_of_Week( @fields ) ); say join "/", @new_date;