Created
January 23, 2013 08:44
-
-
Save AlexDenisov/4603229 to your computer and use it in GitHub Desktop.
Iterate few lists with Perl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment