in reply to Re^2: Error parsing using Time::Piece
in thread Error parsing using Time::Piece

You will need to add a leading zero to that:

my $date = Time::Piece->strptime("032015", "%m%Y");

Maybe you could use sprintf?

perl -MTime::Piece -le'print Time::Piece->strptime( sprintf( "%06d", " +32015"), "%m%Y" )'

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)

Replies are listed 'Best First'.
Re^4: Error parsing using Time::Piece
by Anonymous Monk on Apr 28, 2015 at 19:05 UTC
    It seems that if I convert this line in my code from:
    my $last_month_num = $t->add_months(-1)->mon;

    to:
    my $last_month_num = sprintf("%02d",$t->add_months(-1)->mon);

    It should take care of the problem!