develooper Front page | perl.perl5.porters | Postings from March 2016

Re: [perl #127684] operators '|||' and '&&&'

Thread Previous | Thread Next
From:
Kent Fredric
Date:
March 10, 2016 13:10
Subject:
Re: [perl #127684] operators '|||' and '&&&'
Message ID:
CAATnKFDyrNW2p4Tq8M=OFKOTzsShHTjWP3_x4LUFavVqqg+BYQ@mail.gmail.com
On 11 March 2016 at 01:50, Paul "LeoNerd" Evans <leonerd@leonerd.org.uk> wrote:
>> then '&&&' would be just the natural thing for the AND-variant.
>> Did I overlook something that would have prevented use of those
>> operators?
>
> There's no need for a "defined-and" operator in Perl, because there is
> no undefined value that is true. The regular "and" operators are fine
> in this circumstance.


I'm going to have to know what interpretation of code is expected from
defined-and before I Understand this claim.

Both my interpretations don't hold the same behaviour as &&


>                   0: defined-and(0) =     "true", defined-and(1) =        "0", andand =        "0"
>        empty-string: defined-and(0) =     "true", defined-and(1) =         "", andand =         ""
>              truthy: defined-and(0) =     "true", defined-and(1) =   "truthy", andand =     "true"
>               undef: defined-and(0) =      undef, defined-and(1) =      undef, andand =      undef

-- 
Kent

KENTNL - https://metacpan.org/author/KENTNL

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About