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

The real question is why it returns "!!0" and "!!1" instead of "!1" and "!0". Saves a character and a runtime op...
  • Comment on Re^2: Why is Dumper returning "!!1" for true file test?

Replies are listed 'Best First'.
Re^3: Why is Dumper returning "!!1" for true file test?
by LanX (Saint) on Jan 21, 2024 at 00:11 UTC
    > Saves a character and a runtime op...

    And is confusing because you need to mentally negate it again, while !! is a common idiom.

    But the performance question occurred to me already I kind of expected constant folding to happen.

    update

    ha, indeed! :)

    DB<5> p B::Deparse->new()->coderef2text( sub{!!1} ) { use feature ... ; # shortened !0; } DB<6> p B::Deparse->new()->coderef2text( sub{!!0} ) { use feature ... ; # yadda !1; } DB<7> p $] 5.038002

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