my $current_month = strftime "%m", localtime; my $previous_month = $current_month - 1; my $previous_month = sprintf("%02d", $previous_month);