Strtol

Score: 131.41 (pass)

Re-arranging terms saves another two strokes.

#!perl -pal
$*+=9x(3*/b|d/+6*/ll/-/^h/)*($*%1e3)||/te|l/.2*/s|w|th/+/ne|fi|ev|th/+4*/s|f/+8*/g|^n/.$|x/y/for@F;s/\B..\d\b/,$&/for($_=$*)x3

Score: 133.41 (pass)

.0 instead of *10 etc. Numbers are strings!

they sure are

#!perl -pal
$*+=9x(3*/b|d/+6*/ll/-/^h/)*($*%1e3)||/te|l/.0+/ne|fi|ev|th/+2*/s|w|th/+4*/s|f/+8*/g|^n/.$|x/y/for@F;s/\B..\d\b/,$&/for($_=$*)x3

Score: 137.42 (pass)

Changing + to || allows me to save six strokes in the second half of the expression.

You're getting closer!

#!perl -pal
$*+=9x(3*/b|d/+6*/ll/-/^h/)*($*%1e3)||(/ne|fi|ev|th/+2*/s|w|th/+4*/s|f/+8*/g|^n/+10*/te|l/)*10**/y/for@F;s/\B..\d\b/,$&/for($_=$*)x3

Score: 142.40 (pass)

More fiddling with the string-to-number function to lose another four strokes.

#!perl -pal
$*+=9x(3*/b|d/+6*/ll/-/^h/)*($*%1e3)+(/ne|fi|ev/+2*/^s|w/+3*/h.?r/+4*/^s|f/+8*/g|^n/+10*/te|el/)*10**/y/for@F;s/\B..\d\b/,$&/for($_=$*)x3

Score: 146.40 (pass)

To my surprise, I can lose yet another stroke from the comma-ing routine.

#!perl -pal
$*+=9x(3*/us|b/+6*/ll/+2*/^h/)*($*%1e3)+(/ne|fi|ev/+2*/^s|w/+3*/h.?r/+4*/^s|f/+8*/g|^n/+10*/te|el/)*10**/y$/for@F;s/\B..\d\b/,$&/for($_=$*)x3

Score: 147.41 (pass)

Lose another three strokes from comma-ing expression to get sub-150.

#!perl -pal
$*+=9x(3*/us|b/+6*/ll/+2*/^h/)*($*%1e3)+(/ne|fi|ev/+2*/^s|w/+3*/h.?r/+4*/^s|f/+8*/g|^n/+10*/te|el/)*10**/y$/for@F;s/\B\d{3}\b/,$&/for($_=$*)x3

Score: 150.41 (pass)

Improved comma-adding routine. Also improved tie-breaker for reduced legibility. :-)

#!perl -pal
$*+=9x(3*/us|b/+6*/ll/+2*/^h/)*($*%1e3)+(/ne|fi|ev/+2*/^s|w/+3*/h.?r/+4*/^s|f/+8*/g|^n/+10*/te|el/)*10**/y$/for@F;$_=$*;1until!s/\B(?=\d{3}\b)/,/

Score: 152.45 (pass)

Accumulate into one variable instead of an array.

#!perl -pal
$a+=9x(3*/us|b/+6*/ll/+2*/hu/)*($a%1e3)+(/ne|fi|ev/+2*/^s|w/+3*/hi?r/+4*/^s|f/+8*/g|ni/+10*/te|el/)*10**/ty/for@F;$_=$a;1while s/\d(?=\d{3}\b)/$&,/

Score: 172.42 (pass)

Saved another stroke. I'm not going to get close to Mtv this way though...

Why not? Only 25 strokes to go...

#!perl -pal
@a[$x,3]=@a[3,$x=3-/us/-2*/ll/-/b/],($a[3]+=(/ne|fi|ev/+2*/^s|w/+3*/hi?r/+4*/^s|f/+8*/g|ni/+10*/te|el/)*10**/ty/)*=100**/d/for@F;$_=sprintf",%03d"x4,@a;s/^[0,]*(?=.)//

Score: 173.43 (pass)

One-stroke improvement in word-to-number code.

one stroke improvements on the first day!

#!perl -pal
@a[$x,3]=@a[3,$x=3-/us/-2*/ll/-/b/],($a[3]+=(/ne|fi|ev/+2*/^s|w/+3*/hi?r/+4*/^s|f/+8*/g|ni/+10*/te|el/)*10**/ty/)*=100**/hu/for@F;$_=sprintf",%03d"x4,@a;s/^[0,]*(?=.)//

Score: 174.43 (pass)

The number can start with a comma if we're going to strip /^[0,]*/. This saves 7 strokes!

yikes, Bob had better start thinking again

#!perl -pal
@a[$x,3]=@a[3,$x=3-/us/-2*/ll/-/b/],($a[3]+=(/ne|fi|ev/+2*/w/+3*/hi?r/+4*/f/+6*/^s/+8*/g|ni/+10*/te|el/)*10**/ty/)*=100**/hu/for@F;$_=sprintf",%03d"x4,@a;s/^[0,]*(?=.)//

Score: 181.43 (pass)

Much improved word-to-number expression.

#!perl -pal
@a[$x,3]=@a[3,$x=3-/us/-2*/ll/-/b/],($a[3]+=(/ne|fi|ev/+2*/w/+3*/hi?r/+4*/f/+6*/^s/+8*/g|ni/+10*/te|el/)*10**/ty/)*=100**/hu/for@F;$_=sprintf"%03d".",%03d"x3,@a;s/^[0,]*(?=.)//

Score: 202.42 (pass)

Work harder in main string-to-number expression so that it assigns 0 to hundred, thousand, million and billion. Then allows combining expressions in shorter ways.

good idea.. hmmmmm

#!perl -pal

@a[$x,3]=@a[3,$x=3-/us/-2*/ll/-/b/],($a[3]+=(/one/+2*/w/+3*/hi?r/+4*/f/+/fi/+6*/x/+7*/ev/+8*/g/+9*/ni/+4*/el/+6*/lv/+10*/te/)*10**/ty/)*=100**/hu/for@F;$_=sprintf"%03d".",%03d"x3,@a;s/^[0,]*(?=.)//

Score: 215.38 (pass)

Well, it seems that @a[1,2]=@a[2,1] is better than $a[1]^=$a[2]^=$a[1]^=$a[2]. D'oh!

Remember kids, the XOR swap isn't reliable for strings with different bitlengths.

#!perl -pal
($x=/us/*3+/ll/+/m/)&&(@a[$x,3]=@a[3,--$x])||/hu/&&($a[3]*=100)||($a[3]+=(/on/+2*/w/+3*/h/+4*/f/+/fi/+6*/x/+7*/ev/+5*/g/+9*/ni/+4*/l/+6*/lv/+10*/te/)*10**/ty/)for@F;$_=sprintf"%03d".",%03d"x3,@a;s/^[0,]*(?=.)//

Score: 226.37 (pass)

A working solution to get me on the board.

#!perl -pal
($x=/us/*3+/ll/+/m/)&&($a[--$x]^=$a[3]^=$a[$x]^=$a[3])||/hu/&&($a[3]*=100)||($a[3]+=(/on/+2*/w/+3*/h/+4*/f/+/fi/+6*/x/+7*/ev/+5*/g/+9*/ni/+4*/l/+6*/lv/+10*/te/)*10**/ty/)for@F;$_=sprintf"%03d".",%03d"x3,@a;s/^[0,]*(?=.)//