use DateTime::Precise; use strict; my $t1 = DateTime::Precise->new; my %months = ( 1 => q{January}, 2 => q{February}, 3 => q{March}, 4 => q{April}, 5 => q{May}, 6 => q{June}, 7 => q{July}, 8 => q{Auguest}, 9 => q{Septemper}, 10 => q{October}, 11 => q{November}, 12 => q{December}, ); my $thisMonth = $months{$t1->month}; my $prevMonth = $months{$t1->inc_month(-1)->month}; my $t1 = DateTime::Precise->new; my $monthB4rLast = $months{$t1->inc_month(-2)->month}; my $t1 = DateTime::Precise->new; my $monthB4rLast1 = $months{$t1->inc_month(-3)->month}; print "This Month is $thisMonth\n"; print "Previous Month is $prevMonth\n"; print "Month before last is $monthB4rLast\n"; print "Month before 2 months is $monthB4rLast1\n"; Output: ------- ThisMonth is March Next Month is February Month before last is January Month before 2 months is December