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

> Hadn't heard about !!0 and !!1 either.

I hope it's clear that ! is just the logical negation operator.

Double negations are a very common idiom, you will find it in many languages, also in JS.

!!$a is in the same idiomatic niche like 0+$a or "".$a of explicit casting to a certain type without altering the value. Just Boolean now instead of number or string.

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

Replies are listed 'Best First'.
Re^4: Why is Dumper returning "!!1" for true file test?
by nysus (Parson) on Jan 20, 2024 at 22:51 UTC

    Ok, thanks, I wasn't sure. I thought maybe they adopted "!!0" and "!!1" and imbued it with some special meaning beyond double negation.

    $PM = "Perl Monk's";
    $MC = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest Vicar Parson";
    $nysus = $PM . ' ' . $MC;
    Click here if you love Perl Monks