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.
Read about the if statement and comparison operatiors (eq == ne !=).if ($operator eq '-') { $c = $a - $b; } elsif ($operator eq '*') { # * code here } else { $c = 'invalid operator'; }
In Section
Seekers of Perl Wisdom