Perl's lack of 'in' keyword

Dagfinn Ilmari Mannsåker ilmari at ilmari.org
Tue Oct 7 16:20:57 BST 2008


"Paul Makepeace" <paulm at paulm.com> writes:

> ... is starting to frustrate me. It's the one feature I am finding I'm
> really missing from That Other Language.
>
>   if ($bar in @foo) {
>     # ...
>   }

use Perl6::Junction qw/any/;

if ($bar eq any(@foo)) {
  # ...
}

> (Does Perl 6 have it?)

Yes, as does Perl 5, if you count CPAN.

> P, who does not want to make a temporary hash, thankyouverymuch
>

-- 
ilmari
"A disappointingly low fraction of the human race is,
 at any given time, on fire." - Stig Sandbeck Mathisen


More information about the london.pm mailing list