in reply to Perl from PHP

$lastday = date("t", mktime(0,0,0,$month,1,$year)); $temp = (date("w",mktime(0,0,0,$month,$lastday, $year)) - $day_of_week) % 7;
The first line is returning the number of days in the given month. The second line is the day of the week.
Date::Calc has the functions:
Days_in_Month($year, $month)
Day_of_Week($year,$month,$day)

Maybe those two functions, or at least something from Date::Calc, will help you. ust do perldoc Date::Calc for more details.
HTH,
Chris