On Thursday 16 August 2007, Ran Eilam wrote:
> On 8/15/07, Ran Eilam <[EMAIL PROTECTED]> wrote:
> > On 8/15/07, Shlomi Fish <[EMAIL PROTECTED]> 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.
>

Well, you're right that List::MoreUtils is not core and List::Util is. 
However, why is "first" preferable over "any"? I think "any" would be 
preferable here, because we're not interested in the first item that matches, 
just if it exists. And "any" probably short-circuits.

Regards,

        Shlomi Fish

---------------------------------------------------------------------
Shlomi Fish      [EMAIL PROTECTED]
Homepage:        http://www.shlomifish.org/

If it's not in my E-mail it doesn't happen. And if my E-mail is saying
one thing, and everything else says something else - E-mail will conquer.
    -- An Israeli Linuxer
_______________________________________________
Perl mailing list
[email protected]
http://perl.org.il/mailman/listinfo/perl

Reply via email to