[Israel.pm] checking for presence of a value in a list

Ran Eilam ran.eilam at gmail.com
Wed Aug 15 15:06:20 PDT 2007


On 8/15/07, Ran Eilam <ran.eilam at gmail.com> wrote:
> On 8/15/07, Shlomi Fish <shlomif at iglu.org.il> wrote:
> > use List::MoreUtils qw(any);
> > my @set = (1, 2, 3, 4, 5);
> > if (any { $_ == 3 } @set) {  print "found\n" }
>
> Is best, and it's core.

Correction: not best, and not core. Review your posts!

List::Util::first is both.

Ran



More information about the Perl mailing list