I think it is mainly Data::Dumper being anal: Perl has a builtin constant called PL_Yes PL_sv_yes which is used internally for the boolean true value. The Dumper output is effectively saying that this isn't just any old constant 1, but the one and only PL_sv_yes. For a data structure with many copies I guess you'd get something of a memory saving compared to having many unique SVs.
You can see the difference with Devel::Peek:
perl -MDevel::Peek -wle 'Dump(1); Dump(!!1)' SV = IV(0x56346851ef48) at 0x56346851ef58 REFCNT = 1 FLAGS = (IOK,READONLY,PROTECT,pIOK) IV = 1 SV = PVNV(0x5634684f6050) at 0x5634684f43c8 REFCNT = 2147483644 FLAGS = (IOK,NOK,POK,READONLY,PROTECT,pIOK,pNOK,pPOK) IV = 1 NV = 1 PV = 0x563467d5e282 "1" CUR = 1 LEN = 0
Builtins like this have an artificial refcount around 2^31 to indicate "should never be freed, not even accidentally".
Perl v5.36 introduced an actual boolean type, but that doesn't make any noticeable difference to the value except that Devel::Peek now annotates the PV as "[BOOL PL_Yes]".
Update: corrected the internal name of the SV; thanks @ikegami.
In reply to Re: Why is Dumper returning "!!1" for true file test?
by hv
in thread Why is Dumper returning "!!1" for true file test?
by nysus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |