Prior to perl 5.36 it was not possible to identify a boolean true value after it had been copied

This was done by ensuring that the string buffer (PV) of &PL_sv_yes and &PL_sv_no is shared on assignment.

$ 5.34t/bin/perl -MDevel::Peek -e'Dump(!!1); my $x = !!1; Dump($x);' SV = PVNV(0x55852a177160) at 0x55852a1753c8 REFCNT = 2147483644 FLAGS = (IOK,NOK,POK,READONLY,PROTECT,pIOK,pNOK,pPOK) IV = 1 NV = 1 PV = 0x558529a84f64 "1" CUR = 1 LEN = 0 SV = PVNV(0x55852a177220) at 0x55852a178770 REFCNT = 1 FLAGS = (IOK,NOK,POK,pIOK,pNOK,pPOK) IV = 1 NV = 1 PV = 0x55852a1b6010 "1"\0 CUR = 1 LEN = 10 $ 5.36t/bin/perl -MDevel::Peek -e'Dump(!!1); my $x = !!1; Dump($x);' SV = PVNV(0x55d55f1be160) at 0x55d55f1bc3c8 REFCNT = 2147483644 FLAGS = (IOK,NOK,POK,IsCOW,READONLY,PROTECT,pIOK,pNOK,pPOK) IV = 1 NV = 1 PV = 0x55d55e89b984 "1" [BOOL PL_Yes] CUR = 1 LEN = 0 SV = PVNV(0x55d55f1be220) at 0x55d55f1bf770 REFCNT = 1 FLAGS = (IOK,NOK,POK,IsCOW,pIOK,pNOK,pPOK) IV = 1 NV = 1 PV = 0x55d55e89b984 "1" [BOOL PL_Yes] CUR = 1 LEN = 0

is_bool checks if the provided scalar shares a string buffer (PV) with &PL_sv_yes or &PL_sv_no.

Before you had two "levels" of true:

After, three:


In reply to Re^5: Why is Dumper returning "!!1" for true file test? by ikegami
in thread Why is Dumper returning "!!1" for true file test? by nysus

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.