in reply to Why my variable is not 0 ?
Perl operators that return true or false generally return values that can be safely used as numbers. For example, the relational operators in this section and the equality operators in the next one return 1 for true and a special version of the defined empty string, "", which counts as a zero but is exempt from warnings about improper numeric conversions, just as "0 but true" is.
Update: Here's the difference:
use Devel::Peek; my $f = (0 != 0); my $e = q(); Dump($f); Dump($e);
SV = PVNV(0x60003a5a0) at 0x600077cc8 REFCNT = 1 FLAGS = (IOK,NOK,POK,pIOK,pNOK,pPOK) IV = 0 NV = 0 PV = 0x6000b60c0 ""\0 CUR = 0 LEN = 10 SV = PV(0x60003c250) at 0x600077d70 REFCNT = 1 FLAGS = (POK,IsCOW,pPOK) PV = 0x60009a810 ""\0 CUR = 0 LEN = 10 COW_REFCNT = 1
($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Why my variable is not 0 ?
by pcouderc (Monk) on Jan 08, 2016 at 15:09 UTC | |
by Athanasius (Archbishop) on Jan 08, 2016 at 15:17 UTC | |
by pcouderc (Monk) on Jan 08, 2016 at 15:34 UTC |