Hello,
When you write
$calc=3+5-2;
print $calc."\n";
you get 6. (number, not the string "3+5-2")
When you write
while (<STDIN>) {
    $calc=$_;
    print $calc."\n";
    last;
}
if you run that last one and type 3+5-2, you get 3+5-2.(string "3+5-2", not the number 
6)
Why is it so? And how can I get it to calculate the thing?
I have gone through all of the perldoc perlfaqs. Maybe the answer is so simple that I 
don't see it. I am just trying to build a simple calculator. I have found a rather 
complicate solution which works, but there must be a very simple solution, isn't it?

Jacques L

Reply via email to