in reply to Get previous date
Subtract a day? Date::Calc exists for this reason.
use Date::Calc qw[Add_Delta_Days Today]; my ($year, $month, $day) = Today(); print "Today is $year-$month-$day; "; ($year, $month, $day) = Add_Delta_Days( Today(), -1 ); print "Yesterday was $year-$month-$day!\n"; __END__ # the above code prints: Today is 2006-6-30; Yesterday was 2006-6-29!
This way, you'll take into account all the weirdness of dates (like leap-years, to pick a simple example) without very much work. Good luck!
|
|---|