sub score { $i=$z=0;@_=map{(/\d/)?$_:10}@_;while($i++<10){$x=shift;if($x<10){$y=shift;$z+=($y==10)?10+$_[0]:$x+$y;}else{$z+=($_[0]==10)?20+$_[1]:($_[1]==10)?20:10+$_[0]+$_[1];}}$z; }