use DateTime; my $one_month_ago = DateTime->today->subtract(months => 1); print DateTime->last_day_of_month( month => $one_month_ago->month, year => $one_month_ago->year, )->mdy . "\n";'