On Thu, 5 Jul 2001, David Cantrell wrote:
> On Thu, Jul 05, 2001 at 10:43:48AM +0100, Leon Brocard wrote:
> > David Cantrell sent the following bits through the ether:
> >
> > > I wanted to overload == to tell me whether a list contained
> > > a certain scalar
> >
> > Hearing the word "in" is an indication that you probably
> > should have used a hash, not a list or array
>
> There are multiple occurences of the same value in the dataset, so I can't
> use a hash.
use List::Util qw(first);
if (first { $_ eq $element } @list)
{
print "yey!"
}
=head1 first BLOCK LIST
Similar to `grep' in that it evaluates BLOCK setting
'$_' to each element of LIST in turn. `first' returns
the first element where the result from BLOCK is a
true value. If BLOCK never returns true or LIST was
empty then `undef' is returned.
=cut
--
s'' Mark Fowler London.pm Bath.pm
http://www.twoshortplanks.com/ [EMAIL PROTECTED]
';use Term'Cap;$t=Tgetent Term'Cap{};print$t->Tputs(cl);for$w(split/ +/
){for(0..30){$|=print$t->Tgoto(cm,$_,$y)." $w";select$k,$k,$k,.03}$y+=2}