Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: A somewhat unexpected side effect...

by Anonymous Monk
on Nov 21, 2006 at 12:14 UTC ( [id://585241]=note: print w/replies, xml ) Need Help??


in reply to A somewhat unexpected side effect...

You put the emphasis on the wrong part of the quoted documentation. The essential part is has ever been used in a numeric context. Either side of binary + is classifies as numeric context.

The more technical reason is "you get normal increment if the SV isn't a PV".

perl -MDevel::Peek -e '$n = "z"; Dump($n); $f = 3 + $n; Dump($n)' SV = PV(0x804def8) at 0x8063ad0 REFCNT = 1 FLAGS = (POK,pPOK) PV = 0x805cce8 "z"\0 CUR = 1 LEN = 2 SV = PVNV(0x8080dc0) at 0x8063ad0 REFCNT = 1 FLAGS = (IOK,NOK,POK,pIOK,pNOK,pPOK) IV = 0 NV = 0 PV = 0x805cce8 "z"\0 CUR = 1 LEN = 2
As you can see, the variable does change by just looking at it.

Replies are listed 'Best First'.
Re^2: A somewhat unexpected side effect...
by blazar (Canon) on Nov 22, 2006 at 16:14 UTC
    You put the emphasis on the wrong part of the quoted documentation. The essential part is has ever been used in a numeric context. Either side of binary + is classifies as numeric context.

    Indeed that would have been right part to explain the difference re what happens when you uncomment the line with the binary +: in fact it's the one quoted by the author of the original article. (But I didn't want to repeat). However the one I emphasized did apply to what I was discussing around that point i.e. why ++($f='z') is 'aa' and ++($f='9') is 10.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://585241]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (3)
As of 2024-04-26 06:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found