in reply to getting the First day of the month

Time::Local gives the first day of the month:

use Time::Local; my $time = timelocal(0,0,0,1,7,2003); my $day .= localtime($time); print $day, "\n";
which outputs:
Fri Aug 1 00:00:00 2003
Note that the days number from 1, but months number from 0.

Using the list output of localtime would give you a day of the week numeral that you could use to calculate the first Monday.

--Bob Niederman, http://bob-n.com