develooper Front page | perl.perl5.porters | Postings from February 2019

Re: New defined-match operator

Thread Previous | Thread Next
From:
Paul "LeoNerd" Evans
Date:
February 21, 2019 12:22
Subject:
Re: New defined-match operator
Message ID:
20190221122212.1f3fb18f@shy.leonerd.org.uk
On Thu, 21 Feb 2019 11:55:41 +0000
David Cantrell <david@cantrell.org.uk> wrote:

> Well, wouldn't it be nice to be able to write this:
> 
>   if($foo //~ /bar/)
> 
> instead of:
> 
>   if(defined($foo) && $foo =~ /bar/)
> 
> Thoughts?

It's turning into "punctuation soup".

Also how do you distinguish it from applications of the unary bitwise
complement operator on the RHS of the regular // operator?

  $foo // (~$bar)

-- 
Paul "LeoNerd" Evans

leonerd@leonerd.org.uk      |  https://metacpan.org/author/PEVANS
http://www.leonerd.org.uk/  |  https://www.tindie.com/stores/leonerd/

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