$_ = '1 4, 4 5, 6 /, 5 /, x, 0 1, 7 /, 6 /, x, 2 /, 6';see it in action
s/\/, (\d)/\/ $1, $1/g;
s/\/, (x)/\/ 10, x/g;
s/(\d )\//$1.(10-$1)/ge;
s/x, (\d \d)/x $1, $1/g;
s/x/10/g;
s/(((,?)( \d+)+){10}).*/$1/;
s/(\d+) (\d+)/$1+$2/ge;
s/(\d+) (\d+)/$1+$2/ge;
my $total;
s/(\d+)/$total+=$1/ge;
print;
read more
No comments:
Post a Comment