Due to the neat power of POSIX :: mktime, you can do the following:
use POSIX qw<mktime strftime>; my ( $month, $day, $year ) = ( 8, 16, 2008 ); my $end_date = mktime( 0, 0, 0, 1, 2 - 1, 2009 - 1900 ); while ( 1 ) { my $date = mktime( 0, 0, 0, $day++, $month - 1, $year - 1900 ); push @date_range, strftime( '%x', localtime $date ); last if $date >= $end_date; }
With mktime( 0, 0, 0, 500, 0, 108 ) it makes sense. But then this is mktime( 0, 0, 0, 0, 2, x ) for the last date of February for any year.
source share