Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Answer: How do I Loop over multiple arrays simultaneously ?

( #986021=categorized answer: print w/ replies, xml ) Need Help??

Q&A > arrays > How do I Loop over multiple arrays simultaneously ? contributed by jdporter

use List::MoreUtils::each_array:
use List::MoreUtils qw( each_array ); my @a = qw( a b c ); my @b = qw( A B C ); my @c = qw( 1 2 3 ); my $ea = each_array( @a, @b, @c ); while ( my( $a, $b, $c ) = $ea->() ) { print $a, $b, $c; }
:-)

Comment on Answer: How do I Loop over multiple arrays simultaneously ?
Download Code
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (12)
As of 2015-07-03 13:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (53 votes), past polls