in reply to Re^10: appending a variable
in thread appending a variable

well, after getting the digits, check if a single digit, if so, add leading zero. Note this also handles the 0->00 case.
$digits =~ s/^(\d)$/0$1/; # add leading zero if only one digit # 0->00 1->01 2->02 etc.