Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^4: "2" | "8" = ":" and 2|8=10

by JavaFan (Canon)
on Nov 04, 2011 at 12:59 UTC ( #935926=note: print w/replies, xml ) Need Help??


in reply to Re^3: "2" | "8" = ":" and 2|8=10
in thread "2" | "8" = ":" and 2|8=10

I think you're wrong there. Postincrement only works different for strings if they start with a letter. For strings like "199" it makes no difference: you just get 200. And other strings apparently are converted to a number first, as $x = "2A"; $x++ produces 3.
$ perl -E '$x = $y = "A3"; $y + 0; $x++; $y++; say "$x $y"' A4 1 $
The difference is, $y has an integer (as well as a string value), where $x doesn't. And hence, the post-increment value differs.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://935926]
help
Chatterbox?
LanX ... me is scared of people voting for Trumps
[erix]: until good old Putin lobs a bomb on Berlin :)
[Your Mother]: “I’m afraid of Americans…”
[Your Mother]: “No one needs anyone / They don’t even just pretend…”
[erix]: they've stuck nuclear missiles in Kaliningrad - they can just reach Berlin :)
[LanX]: naaah! Putin wouldn't nuke all the Russians in Berlin
[Your Mother]: Putin is a bad guy but he’s not that kind of bad guy. (Who would launch.)
[erix]: fortunately, Putin seems to be ill -- or at least, they're building a hospital for him and his cronies in Moscow
[erix]: nobody knows what kind it takes :)
[erix]: I say his seems a face that launches a thousand missiles :)

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




    Results (173 votes). Check out past polls.