develooper Front page | perl.perl5.porters | Postings from July 2012

Re: Smartmatch two cents (was... List::Util... when...)

Thread Previous | Thread Next
From:
Eric Brine
Date:
July 3, 2012 10:58
Subject:
Re: Smartmatch two cents (was... List::Util... when...)
Message ID:
CALJW-qEJESgsb-Gp-QbWLe5WdZ+=Ez8zubLTo4=_PJZO1m7R7w@mail.gmail.com
On Tue, Jul 3, 2012 at 4:59 AM, Ed Avis <eda@waniasset.com> wrote:

> As in Python, 'in' could work for both arrays and hashes:
>
>    $x in @array
>
>    $x in %hash    # same as exists $hash{$x}
>

So C<< $x in @array >> checks the values, and C<< $x in %hash >> checks the
keys? Isn't that confusing?

With the auto-dereferencing introduced in recent perls, the RHS could
> be an array or hash ref.
>

yuck. I still think the cost of not working for all hashes and arrays is
too high.

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