List::Util

A collection of list-related subroutines. As of Perl 5.8, List::Util is included with the Perl source kit.

You can get the first item of a list (that matches the condition in BLOCK) like so:

#!/usr/local/bin/perl -w
use List::Util qw(first);

my @ll = qw(one two three);

my $fir = first { defined($_) } @ll;
print "$fir
"; # Prints 'one'

List::Util implements (but does not export) the following methods.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.34.161