some more chars to get rid off
#!perl -pal
$r.=/tho|mi|b/g?")*1E".3*(4-pos)."+(":/hu/?E2:'+'./tee|lv/.index(zeontwthfofisiseeiniteel,/../&&$&)/2*10**/y/for@F;$_=eval"($r+0)";s/.(?=(...)+$)/$&,/g
|
slightly improving the commafier PS: Why am I not getting the email notifications? Is something broken?
#!perl -pal
$r.=/tho|mi|b/?")*1E".3*(4-$+[0])."+(":/hu/?"E2":"+"./tee|lv/.index(zeontwthfofisiseeiniteel,/../&&$&)/2*10**/y/for@F;$_=eval"($r+0)";s/\d(?=(\d{3})+$)/$&,/g
|
Heureka! Got rid of the hash too. Nothing can stop me now...
#!perl -pal
$r.=/tho|mi|b/?")*1E".3*(4-$+[0])."+(":/hu/?"E2":"+"./tee|lve/.index(zeontwthfofisiseeiniteel,/../&&$&)/2*10**/y/for@F;$_=eval"($r+0)";1while s/(\d+)(\d{3})/$1,$2/
|
even shorter with string concatenation and an explicit hash for the powers of 10
#!perl -pal
%p=qw(tho 3 m 6 b 9);$r.=/tho|m|b/?")*1E$p{$&}+(":/hu/?"E2":"+"./tee|lve/.index(zeontwthfofisiseeiniteel,/../&&$&)/2*10**/y/for@F;$_=eval"($r+0)";1while s/(\d+)(\d{3})/$1,$2/
|
string index instead of hash is shorter... and I got rid of unneeded parentheses.
#!perl -pal
$p{$_}=++$b*3for@p=(tho,mi,b);$"="|",$_=/@p/?")*1E$p{$&}+(":/hu/?"E2":(/../,$,=index(zeontwthfofisiseeiniteel,$&)/2,/y/?$,*=10:$,+=10*/tee|lve/,"+$,")for@F;$"="";$_=eval"(@F+0)";1while s/(\d+)(\d{3})/$1,$2/
|
#!perl -lpa
$d{$_}=$a++for@v=(ze,on,tw,th,fo,fi,si,se,ei,ni,te,el);$d{$_}=++$b*3for@p=(tho,mi,b);local$"="|",$_=/@p/?"))*1E$d{$&}+((":(/../,$,=$d{$&},/y/?"+$,0":/tee|lve/?"+1$,":/hu/?")*100+(":"+$,")for@F;$_=eval"((@F+0))";1while s/(\d+)(\d{3})/$1,$2/
|