or download this
#!/usr/bin/perl -w
use POSIX qw(strftime);
...
# strftime(fmt, sec, min, hour, mday, mon, year, wday = -1, yday = -1,
+ isdst = -1)
# don't forget that the months start counting from 0 as January
print strftime("%m", 0, 0, 0, 0, $thismonth-2, 0); #prints "05"