% perldoc List::Util 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 retur +ns true or LIST was empty then "undef" is returned. $foo = first { defined($_) } @list # first defined v +alue in @list $foo = first { $_ > $value } @list # first value in +@list which # is greater than + $value
-Blake
In reply to Re: The fastest way of searching a certain element in an array
by blakem
in thread The fastest way of searching a certain element in an array
by ccn
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |