add this:
print $greeting; chomp($operator = <STDIN>); #your other prints and stuff here $c = $a - $b if $operator eq "-"; $c = $a * $b if $operator eq "*";
The if statement could also be written as such:
if ($operator eq "-") { $c = $a - $b; } else { $c = $a * $b; }
"Pain is weakness leaving the body, I find myself in pain everyday" -me
In reply to Re: Help with simple calculator script.
by kutsu
in thread Help with simple calculator script.
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |