my ($y, $m) = ($year-1900, $month-1); # Day before the first of next month: my $last = timelocal_nocheck(0, 0, 0, 1-1, $m+1, $y);