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

Re: New defined-match operator

Thread Previous | Thread Next
From:
David Nicol
Date:
February 21, 2019 20:11
Subject:
Re: New defined-match operator
Message ID:
CAFwScO-+0pOhbGgjDohe3HbgF9EGvgtb9BuoprUCud6gQpij_Q@mail.gmail.com
>
> > instead of:
> >
> >   if(defined($foo) && $foo =~ /bar/)
>


the only improvement on that I can come up with is to write it

   if(defined($foo) and $foo =~ /bar/)

if we're pitching new syntax, how about a loquacious variant of =~ m,
spelled "matches"?

   if(defined($foo) and $foo matches /bar/)

The dangerous coffee suggests then having a loquacious variant of =~ s ...
which as it cuts and pastes, might be called "scissors"


then we could play with matches and run with scissors :)




-- 
"I don't know about that, as it is outside of my area of expertise." --
competent specialized practitioners, all the time

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