TIMTOWTDI, of course. A slightly different approach, still with Time::Piece but adding a month at a go. It's shorter and (to me) a little clearer.
#!/usr/bin/env perl use strict; use warnings; use Time::Piece '1.32'; my $date = localtime->add_years (-4)->truncate (to => 'year'); my $end_date = localtime; while ($date <= $end_date) { print "$date\n"; $date = $date->add_months (1); }
There's nothing wrong with your method AFAICS.
In reply to Re: RFC: List of first day of each month
by hippo
in thread RFC: List of first day of each month
by TieUpYourCamel
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |