http://qs1969.pair.com?node_id=1083402


in reply to Re^2: Results depending on evaluation order
in thread Results depending on evaluation order

eval expects a string, so the number is converted to a string, and the stringification rounds a tiny bit, so it accidentally produces the right result.

  • Comment on Re^3: Results depending on evaluation order

Replies are listed 'Best First'.
Re^4: Results depending on evaluation order
by choroba (Cardinal) on Apr 23, 2014 at 20:54 UTC
    You can prepend a q before the ( to make eval work correctly, i.e. report the difference.
    $premium = eval q($number * ( 1 + 10/100 ));
    لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ