in reply to Inchworm vs scalar: on boolean false value

~ is a binary operation not a Boolean, IIRC.

If you want Boolean results use !! instead.

Update

Uhm ... I think it might not do what you think it does.

Binary "~~" does a smartmatch between its arguments.

Better run B::Deparse to understand what the parser sees.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

Replies are listed 'Best First'.
Re^2: Inchworm vs scalar: on boolean false value
by Fletch (Bishop) on Dec 17, 2019 at 14:32 UTC

    Link to what he's using in perlsecret. Interestingly enough Deparse doesn't get much to work with (looks like the constant values generated are what's available; 5.26.1 using -MO=Deparse,-p,-q)

    BEGIN { $/ = "\n"; $\ = "\n"; } use strict; use warnings; map({print((('[' . $_) . ']'));} scalar((!1)), '', 0, 0);

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.

Re^2: Inchworm vs scalar: on boolean false value
by Eily (Monsignor) on Dec 17, 2019 at 14:30 UTC

    Binary "~~" does a smartmatch between its arguments.
    Here it's the unary ~~ though (or rather, two unary ~ in a row), because of the commas, the same way that A, -B is a list of two values, not the difference between the list (A,) and the scalar B.

      It looked unary for me too, but I'd rather prefer being sure.

      That's why I mentioned Deparse.

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      Wikisyntax for the Monastery FootballPerl is like chess, only without the dice