Try something along these lines-
... my $statement = "4 $op 5"; print join(" = ", $statement, eval $statement), $/; ... __END__ 4 + 5 = 9 4 - 5 = -1 4 * 5 = 20 4 / 5 = 0.8
eval can be dangerous since it executes any code so be careful with it.
In reply to Re: Array of operators ...
by Your Mother
in thread Array of operators ...
by janDD
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |