first
first {BLOCK
} @list
Evaluates a block of Perl code and sets $_
to each element of the list in turn.
If BLOCK
is true, first
returns the first element. If
BLOCK
never returns true, or @
list
has no
items, then first
returns
undef
. Note that first
doesn’t necessarily return the
first item in a list. Consider the following:
my @ll = qw(1 2 3); my $fir = first { $_ > 1 } @ll; print "$fir "; # Prints '2', since as 2 is the first item # in BLOCK that's > 1
18.117.138.178