in reply to Re^2: Numification of strings
in thread Numification of strings
in Perl, everything is a string until used in a numeric context
I don't think that is true.
In your example you put quotation-marks around the value, so little surprise that you end up with a string...
Consider this:
This produces:use Devel::Peek; my $a = "1"; my $b = 2; print Dump($a); print Dump($b);
As you can see $a is a string "PV", while $b is an int "IV", even thought it was never used in an numeric context.SV = PV(0x98c9700) at 0x98ea3f8 REFCNT = 1 FLAGS = (PADMY,POK,pPOK) PV = 0x98e6368 "1"\0 CUR = 1 LEN = 4 SV = IV(0x98ea474) at 0x98ea478 REFCNT = 1 FLAGS = (PADMY,IOK,pIOK) IV = 2
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: Numification of strings
by ww (Archbishop) on Aug 02, 2010 at 18:27 UTC | |
by morgon (Priest) on Aug 02, 2010 at 19:06 UTC | |
Re^4: Numification of strings
by Marshall (Canon) on Aug 02, 2010 at 18:11 UTC |
In Section
Seekers of Perl Wisdom