in reply to Re: searching a list
in thread searching a list

I would also suspect that List::Util has something useful

yeah, first.

use List::Util qw( first ); my $found = defined first { $_ eq 'at' } @s;

By the way,
my $ct = scalar ...
is the same as
my $ct = ...

Replies are listed 'Best First'.
Re^3: searching a list
by McDarren (Abbot) on Jun 27, 2006 at 04:49 UTC
    By the way, my $ct = scalar ... is the same as my $ct = ...

    Yeah, true... but I think some people (myself included) adopt the practice (in these sorts of situations) of using scalar anyway, just so as to remove any doubt about the intention. Personally, I think it's not a bad practice, and I'm not aware of any performance hit - or is there? :)