{ my(@g)=@_; my(@c)=@g; my($t, $s, $m, $p, $f, $h); foreach (@c) { s/[Xx]/10/; s/\//10-$p/e; $p=$_; } while(@g) { $s=shift(@c); $_=shift(@g); /X/ && ($t += $s + $c[0] + $c[1], $f++, $h=0, $f>9?last:next); /\// && ( $t += $s + $c[0], $f++, $h=0, $f>9?last:next); $h=$h?($f++,0):1 $t+=$s; $h++; } $t; }