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

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

Thread Previous
H.Merijn Brand
March 10, 2016 12:19
Re: [perl #127684] operators '|||' and '&&&'
Message ID:
On Thu, 10 Mar 2016 04:10:02 -0800, "Ulrich Windl" (via RT)
<> wrote:

> Hi!
> While writing a program for perl-5.10, I wondered whether the is an
> AND-equivalent for '//' for a closure like
> sub {
>     my $hi = $header_i{(shift)}  ??? return $hi;
>     die;
>     };

When the defined-or was introduced, there was: the "err" keyword, which
was implemented as a weak keyword.

Later it has been removed.

> Where '???' is the operator that doesn't exist.

Currently there is none. One of the reasons for removal was the fact
that "err" could clash with existing function names (as field tests
proved). Other names were suggested, but none where seen as acceptable
enough to warrant the potential clash.

> Thus I wondered why the perl gurus didn't choose '|||' instead of
> '//'; then '&&&' would be just the natural thing for the AND-variant.
> Did I overlook something that would have prevented use of those
> operators?

Personally, I'd love to see the return of "err" (or whatever name would
be chosen), but I am not holding my breath till that happens.

> Regards,
> Ulrich

H.Merijn Brand   Perl Monger
using perl5.00307 .. 5.23   porting perl5 on HP-UX, AIX, and openSUSE

Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About