in reply to Month Dates

I'm probably missing something, as this looks just too easy ... but have you considered modulus?

Your code with minimal changes:

my $tm = localtime; my $this_month = sprintf("%04d%02d?", $tm->year+1900, $tm->mon()+1, ); my $last_month = sprintf("%04d%02d?", $tm->year+1900-($tm->mon()<1 ? 1 : 0), ($tm->mon()-1)%12+1, ); my $last_month_1 = sprintf("%04d%02d?", $tm->year+1900-($tm->mon()<2 ? 1 : 0), ($tm->mon()-2)%12+1, ); my $last_month_2 = sprintf("%04d%02d?", $tm->year+1900-($tm->mon()<3 ? 1 : 0), ($tm->mon()-3)%12+1, );

Edit: Bah, yeah, that was too easy. Forgot the year. Fixed now.

print "Just another Perl ${\(trickster and hacker)},"
The Sidhekin proves Sidhe did it!