in reply to get previous month in two digit number

With DateTime, you can:

perl -MDateTime -E 'say DateTime->now->month' perl -MDateTime -E 'say DateTime->now->subtract(months=>1)->month'

The output (we're currently in July):

7 6

Dave