Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^2: Results depending on evaluation order

by fishy (Scribe)
on Apr 23, 2014 at 16:50 UTC ( #1083392=note: print w/replies, xml ) Need Help??


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

Interesting. Thanks Rolf!

What about eval? Why it got right evaluated?
  • Comment on Re^2: Results depending on evaluation order

Replies are listed 'Best First'.
Re^3: Results depending on evaluation order
by moritz (Cardinal) on Apr 23, 2014 at 17:51 UTC

    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.

      You can prepend a q before the ( to make eval work correctly, i.e. report the difference.
      $premium = eval q($number * ( 1 + 10/100 ));
      لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1083392]
help
Chatterbox?
[MidLifeXis]: Most likely it is a code that some undocumented system, hidden behind layers of IT, deep in the bowels of the building under the machine room floor, reads that code to keep a presence switch from going off. :-b
[MidLifeXis]: I think I forgot "running on a farm of commodore 64, vic 20s, trs 80s, and apple ]|[e systems"
[GotToBTru]: oh I know what it is .. but it is a number only slightly useful to me and of no possible use to our customer
[MidLifeXis]: Whew - you just saved the free world. <o)
[GotToBTru]: i guess it's a placeholder, the code will only fill it in if there is nothing else to use
[GotToBTru]: but then .. if you have nothing to say, why not say nothing?
[MidLifeXis]: I have a user who has a lot of say on how some of our processes work that abhors significant blanks. Perhaps that is a part of it. A not-so-obvious "this space intentionally left blank" indicator.

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (8)
As of 2017-01-20 19:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (176 votes). Check out past polls.