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

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

Thread Previous | Thread Next
Eric Brine
July 3, 2012 10:58
Re: Smartmatch two cents (was... List::Util... when...)
Message ID:
On Tue, Jul 3, 2012 at 4:59 AM, Ed Avis <> 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 Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About