in reply to Re^3: Why is Dumper returning "!!1" for true file test?
in thread Why is Dumper returning "!!1" for true file test?

FWIW and I don't think !!1 used to be dualvar (see Scalar::Util ) prior to 5.36.

It's actually a triplevar, and it has been so at least as far back as 5.6, but probably a lot further back.

I don't have 5.6, but here's 5.8.9:

$ 5.8.9/bin/perl -MDevel::Peek -e'Dump(!!1)' SV = PVNV(0x55e2de0d1348) at 0x55e2dd477310 REFCNT = 2147483647 FLAGS = (IOK,NOK,POK,READONLY,pIOK,pNOK,pPOK) IV = 1 NV = 1 PV = 0x55e2de0d2320 "1"\0 CUR = 1 LEN = 8 $ 5.8.9/bin/perl -MDevel::Peek -e'Dump(!!0)' SV = PVNV(0x55aeb71e8320) at 0x55aeb5e05da0 REFCNT = 2147483647 FLAGS = (IOK,NOK,POK,READONLY,pIOK,pNOK,pPOK) IV = 0 NV = 0 PV = 0x55aeb71e8300 ""\0 CUR = 0 LEN = 8

Replies are listed 'Best First'.
Re^5: Why is Dumper returning "!!1" for true file test?
by LanX (Saint) on Jan 22, 2024 at 08:27 UTC
    In the case of !!1 it seems to only be just a performance thing, because all values are just 1 , i.e. any later casting would produce the same effect/caching of types.

    I was confused because prior to this I only heard of !!0 as dualvar and I'm kinda sure I read it in the perldocs.

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

      In the case of !!1 it seems to only be just a performance thing

      I think so. It is slightly different — I can get pPOK+pIOK+pNOK, but I can't also get IOK+NOK+POK — so there could be difference, but I don't know of any.