I guess your vars contain linefeeds. Try
chomp ( $firstNum, $secNum );
print " The product of the first number:$firstNum and second number:$s
+ecNum is:$product\n";
| [reply] [d/l] |
Prabably because $firstNum is actually the string "7\n", that is, a 7 followed by a newline. You probably got these interactively by reading from a terminal, or you read it as a line from a file, and didnt trim the newline off
Try doing a chomp($firstNum);
And guessing you aren't a native english speaker, it is a line break. A brake is what you use on your car to stop. English is such a pain with these type of things, called homophones (meaning same-sounding). You try these ones that are all pronounced the same
toe tow
bear bare
pour paw poor pore
not knot
...it is better to be approximately right than precisely wrong. - Warren Buffet
| [reply] [d/l] |
If you are reading the inputs thru user by <STDIN> then you should use chomp command to remove the newline charecter.
then you can see you are output.
chomp($firstNum=<STDIN>);
#$firstNum="7";
$secNum="5";
$product="35";
print " The product of the first number:$firstNum and second number:$s
+ecNum is:$product\n";
thanks | [reply] [d/l] |