Strtol

Score: 231.51 (pass)

The heads of the numbers don't need to be mutually exclusive. It's a list so we can guarantee ordering!

#!perl -alp
@~=qw~h tho m b twel z o tw th fo f si s ei n t e~;@:{@~}=(qw~*100+ )*1e3+( )*1e6+( )*1e9+(~,12,0..11);for(@F){s/y/*10+/;s/een/+10/}for$~(@~){map{s/^$~\w+/$:{$~}/}@F}$_="(@F)";s/\+ *\)/)/g;$_=eval;1while s/(\d+)(\d{3})/$1,$2/;

Score: 246.51 (pass)

Heh, use stringification to ditch the join().

#!perl -alp
@~=qw'z o tw th fo fi si se ei n te el tl h x m b';@:{@~}=(0..12,qw'*100+ )*1e3+( )*1e6+( )*1e9+(');for(@F){s/y/*10+/;s/een/+10/;s/wel/l/;s/tho/x/}for$~(@~){map{s/^$~\w+/$:{$~}/}@F}$_="(@F)";s/\+ *\)/)/g;$_=eval;1while s/(\d+)(\d{3})/$1,$2/;

Score: 255.53 (pass)

$score -= 20; # hm, should've paid more attention when I was working out the string building!

#!perl -alp
@n=qw'z o tw th fo fi si se ei n te el tl h x m b';@a{@n}=(0..12,qw'*100+ )*1e3+( )*1e6+( )*1e9+(');for(@F){s/y/*10+/;s/een/+10/;s/wel/l/;s/tho/x/}for$q(@n){map{s/^$q\w+/$a{$q}/}@F}$_=join'','(',@F,')';s/\+\)/)/g;$_=eval;1while s/(\d+)(\d{3})/$1,$2/;

Score: 276.51 (pass)

Last one for a while, I think... running to the end of this road.

#!perl -alp
@n=qw'z o tw th fo fi si se ei n te el tl h x m b';@a{@n}=(0..12,qw'*100+ )*1e3+( )*1e6+( )*1e9+(');for(@F){s/y/*10+/;s/een/+10/;s/wel/l/;s/tho/x/}for$q(@n){map{s/^$q\w+/$a{$q}/}@F}$_=join'',@F,')';s/\+\)/\)/g;$_=eval('('x(tr/)//-tr/(//).$_);1while s/(\d+)(\d{3})/$1,$2/;

Score: 286.51 (pass)

A few more improvements.

#!perl -alp
@n = qw'z o tw th fo fi si se ei ni te el tl h x m b';@a{@n}=(0..12,qw'*100+ )*1e3+( )*1e6+( )*1e9+(');for(@F){s/y/*10+/;s/een/+10/;s/wel/l/;s/tho/x/}for$q(@F){map{$q=~s/^$_\w+/$a{$_}/}@n}$_=join'',@F,')';s/\+\)/+0\)/g;$_=eval('('x(tr/)//-tr/(//).$_);1while s/^(\d+)(\d{3})/$1,$2/;

Score: 299.58 (pass)

#!perl -alp
%a=qw'z 0 o 1 tw 2 th[ir] 3 fo 4 fi 5 si 6 se 7 ei 8 ni 9 te 10 el 11 tl 12 h *100+ tho )*1e3)+( m )*1e6)+( b )*1e9+(';for(@F){s/y/*10+/;s/een/+10/;s/wel/l/}for$q(@F){map{$q=~s/^$_\w+/$a{$_}/}keys%a}$_=join'',@F,')';$_='('x(tr/)//-tr/(//).$_;s/\+\)/+0\)/g;$_=eval;1while s/^(\d+)(\d{3})/$1,$2/;

Score: 309.56 (pass)

Slightly more aggressive.

#!perl -ap
%a=qw'z 0 o 1 tw 2 th[ir] 3 fo 4 fi 5 si 6 se 7 ei 8 ni 9 te 10 el 11 tl 12 h *100+ tho )*1e3)+( m )*1e6)+( b )*1e9+(';for(@F){s/ty/*10+/;s/teen/+10/;s/wel/l/}for$q(@F){map{$q=~s/^$_\w+/$a{$_}/}keys%a}$_=join('',@F).')';$_='('x(tr/)//-tr/(//).$_;s/\+\)/+0\)/g;$_=eval()."\n";1while s/^(\d+)(\d{3})/$1,$2/;

Score: 512.51 (pass)

Just a baseline solution, yet to optimize it.

#!perl
@a = reverse split(/\s/,<>);
%a = (z,0,o,1,'tw',2,'th[ir]',3,fo,4,fi,5,si,6,se,7,ei,8,ni,9,te,10,el,11,tl,12);
%b = ('h','*100+','tho',')*1e3)+(','m',')*1e6)+(','b',')*1e9)+(');
foreach(@a){s/ty/*10+/;s/teen/+10/;s/twel/tl/}
foreach $q (@a) {map{$q=~s/^$_\w+/$a{$_}/} keys %a}
foreach $q (@a) {map{$q=~s/^$_\w+/$b{$_}/} keys %b}
$f = join('',reverse@a) .')';
$f = '(' x ($f=~tr/)// - $f=~tr/(//) . $f;
$f =~ s/\+\)/+0\)/g;
# print "F: $f\n";
$g = eval($f);
1 while $g=~s/^([-+]?\d+)(\d{3})/$1,$2/;
print $g."\n";