On Mon, Feb 28, 2022 at 02:15:42AM -0800, Darren Duncan wrote: > On 2022-02-28 1:41 a.m., Dan Book wrote: > > Likewise, "0+$w" produces a number so its result is "originally" a > number, so do that, or some other explicit cast operator like "int $w" > etc, with values pulled from JSON to make them canonically numbers. -- > Darren Duncan I think it all depends if a new SV was created. We've seen that some string operations operate on the original string. I doubt this is the case with assignment or numbers, so I expect the result of 0+ is indeed a new original SV. Actually, let me follow Yves' suggestion and test my assumptions: $ perl -MDevel::Peek -e '$a="1";Dump($a); $b=0+$a; Dump($b)' SV = PV(0x564576205ec0) at 0x564576230d80 REFCNT = 1 FLAGS = (POK,IsCOW,pPOK) PV = 0x564576231b90 "1"\0 CUR = 1 LEN = 10 COW_REFCNT = 1 SV = IV(0x564576230e18) at 0x564576230e28 REFCNT = 1 FLAGS = (IOK,pIOK) IV = 1 -- Philippe Bruhat (BooK) "Did I err?" (Groo, in too many issues to count - ...and *YES* he did!)Thread Previous | Thread Next