D
Dale Henderson
DH> In fact the first step of the Luhn test can be done with:
DH> $cc=1234567890123456
Make that $cc="1234567890123456";
Sorry I didn't test with such a large number.
DH> $cc=~s/(\d)(\d)/(x==9?9$1*2)%9).$2/eg;
DH> This assumes the length of $cc is even (for odd length a
DH> different replacement is needed) and doubles the odd numbered
DH> digits with appropriate modifications (add the digits of 2
DH> digit numbers).
DH> For the next step putting a plus between the digits and
DH> using an eval would work.
DH> $cc=1234567890123456
Make that $cc="1234567890123456";
Sorry I didn't test with such a large number.
DH> $cc=~s/(\d)(\d)/(x==9?9$1*2)%9).$2/eg;
DH> This assumes the length of $cc is even (for odd length a
DH> different replacement is needed) and doubles the odd numbered
DH> digits with appropriate modifications (add the digits of 2
DH> digit numbers).
DH> For the next step putting a plus between the digits and
DH> using an eval would work.