http://qs1969.pair.com?node_id=301883


in reply to Help with simple calculator script.

If it's a homework than maybe eval can't be used yet.

You just need to read in the operator (- *) just like you read in the Name. Then you can use if.

if ($operator eq '-') { $c = $a - $b; } elsif ($operator eq '*') { # * code here } else { $c = 'invalid operator'; }
Read about the if statement and comparison operatiors (eq == ne !=).