for $o (<>){
($frst) = $o =~ /^(\d+)/;
$o =~ s/^(\d+)//;
$t = $frst;
$ostr = "$frst ";
while( ($op, $num) = $o =~ /^([^\d])(\d+)/ ){
$o =~ s/[^\d]\d+//;
$ostr .= "$op $num ";
$t = eval("$t $op $num");
}
print("$ostr= $t\n");
}
Note that non-ascii characters in the above source code will be escaped (such as \x9f).