in reply to Re^3: "" but true
in thread "" but true

Re: Truth and Falsehood

Replies are listed 'Best First'.
Re^5: "" but true
by syphilis (Archbishop) on May 14, 2021 at 09:57 UTC
    I followed your link.
    I did say the "the dualvar will be True if the second arg is True", and the second arg is the stringy arg.
    But you're right, I could have been more explicit - especially since LanX had speculated in the direction of "numeric context".
    (I missed an opportunity to score a point there !! ;-)

    Cheers,
    Rob
Re^5: "" but true
by LanX (Saint) on May 14, 2021 at 08:41 UTC
    Yeah this makes sense since the string " " is true while it's numeric value is 0, so the stringy part must be tested if available.

    DB<50> $a=" " DB<51> $b = $a+0 # $a will cache its numeric val DB<52> p !!$a # still true 1 DB<53> use Devel::Peek DB<54> Dump $a SV = PVNV(0x3fbd6f8) at 0x4aeebe0 REFCNT = 1 FLAGS = (POK,pIOK,pNOK,pPOK) IV = 0 # <-- integer NV = 0 PV = 0x4c4fb58 " "\0 # <-- string CUR = 1 LEN = 10 DB<55> Dump $b SV = NV(0x4aeedf0) at 0x4aeee08 REFCNT = 1 FLAGS = (NOK,pNOK) NV = 0 DB<56>

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery