foreach my $item (1..12) { my $year = 2003; my $month = $item; my $day = 12; my ($week,undef)=Week_of_Year($year,$month,$day); my (undef, $tmpmonth, $firstmonday)=Monday_of_Week($week,$year); if ($tmpmonth != $month) { (undef, undef, $firstmonday)=Monday_of_Week(++$week,$year); }