http://www.perlmonks.org?node_id=1001450


in reply to How to find the last date of the previous month?

Here is one way:

#! perl use strict; use warnings; use Date::Calc qw(Days_in_Month Today); print 'The last day of last month was ', last_day_last_month(), "\n"; sub last_day_last_month { my ($year, $month, $day) = Today([time]); if (--$month == 0) { $month = 12; --$year; } return sprintf("%02d/%d/%d", $month, Days_in_Month($year, $month), $year); }

Hope that helps,

Athanasius <°(((><contra mundum