in reply to Luhn Number Golf
sub luhn { #234567890123456789012345678901234567890123456789012345678901234567 $a=0;$_=reverse pop;s/(.)(.?)/$a+=$1+($2&&(($2*2-1)%9)+1)/ge;1>$a%10 }
_____________________________________________________
Jeff[japhy]Pinyan:
Perl,
regex,
and perl
hacker, who'd like a (from-home) job
s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;
|
|---|