Link to home
Start Free TrialLog in
Avatar of 1030071002
1030071002Flag for United States of America

asked on

need some help getting this simple perl program to run

print "Rey Calculator";
print "\n";
print "Please Enter the first Number";
chomp($a = <STDIN>);
print "\n";
print "Please Enter the second Number\n";
chomp ($b = <STDIN>);
print "\n";
print "Please Enter the Operator"
chomp ($operation = <STDIN>);
print "\n";
#The following if statement assigns the command line arguments to a variable ($operation)
if ($operation eq +) {
$result = $a + $b;
}elsif ($operation eq -) {
$result = $a - $b;
}elsif ($operation eq /) {
$result = $a / $b;
}elsif ($operation eq x) {
$result = $a * $b;
}
print $a $operation $b = $result\n;


C:\>perl cal.pl
syntax error at cal.pl line 10, near "chomp"
Unrecognized character \x93 in column 19 at cal.pl line 13
SOLUTION
Avatar of ozo
ozo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial