Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://935926]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2017-07-27 22:39 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (422 votes). Check out past polls.