use v5.10; use Time::Moment; my $tm1 = Time::Moment->new(year => '2019', month => '6', day => '1'); my $tm2 = Time::Moment->now; $tm1 = (say $tm1->strftime('%c') and $tm1->plus_months(1)) while $tm1 <= $tm2; #### Mon Jul 1 00:00:00 2019 Thu Aug 1 00:00:00 2019 Sun Sep 1 00:00:00 2019 Tue Oct 1 00:00:00 2019 Fri Nov 1 00:00:00 2019 Sun Dec 1 00:00:00 2019 Wed Jan 1 00:00:00 2020