% 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 returns true or LIST was empty then "undef" is returned. $foo = first { defined($_) } @list # first defined value in @list $foo = first { $_ > $value } @list # first value in @list which # is greater than $value