1030071002
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
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.