On 01/26/2011 12:06 PM, Brad Baxter wrote: > Perl *is* storing '1 x' as a number. Very interesting. Not exactly: $ perl -MDevel::Peek -E '$b = "1 x"; say Dump($b); 0 + $b; say Dump($b); say $b."yz"' SV = PV(0x14aceb68) at 0x14aee1d0 REFCNT = 1 FLAGS = (POK,pPOK) PV = 0x14ae80f0 "1 x"\0 CUR = 3 LEN = 8 SV = PVNV(0x14ad0290) at 0x14aee1d0 REFCNT = 1 FLAGS = (IOK,NOK,POK,pIOK,pNOK,pPOK) IV = 1 NV = 1 PV = 0x14ae80f0 "1 x"\0 CUR = 3 LEN = 8 1 xyz The first type we dump $b is as a pure "string" where the second time, $b is now both a string and a number (actually an integer and a floating point). As you can see, if you perform an explicit string operation line catenate, the PV value is used, not the IV or NV... JohnThread Previous | Thread Next