Iterate few lists with Perl
use List::MoreUtils qw( each_array );
my @first = qw( foo bar buzz );
my @second = (1, 2, 3);
my $it = each_array( @first, @second );
while ( my ($f, $s) = $it->() ) {
print "$f = $s\n";
}
# Output
# foo = 1
# bar = 2
# buzz = 3
Written by AlexDenisov
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Perl
Authors
janosgyerik
25.11K
Jean-Remy Duboc
12.22K
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#