my $_next_month = timelocal(0, 0, 0, 1, $_month % 12, $_next_year); my $_last_day = (localtime($_next_month - 86400))[3];