Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: All Combinations of three arrays. (Algorithm::Loops)

by tye (Sage)
on Aug 27, 2005 at 17:22 UTC ( #487168=note: print w/replies, xml ) Need Help??


in reply to All Combinations of three arrays.

Simple use of Algorithm::Loops, but so simple I didn't test it. (:

#!/usr/bin/perl -w use strict; use Algorithm::Loops qw( NestedLoops MapCarE ); my @data = ( [ [1, "Darth Vader"], [3, "Luke Skywalker"], [5, "Obi Wan Kenobi"], ],[ [0, "Lighsabre "], [5, "Blaster"], [9, "Rocket launcher"], ],[ [10, "Dagobah"], [14, "Kashyyyk"], ], ); my @joined= NestedLoops( \@data, sub { my( $dig, $txt )= MapCarE { [ @_ ] } @_; [ join('',@$dig), join(', ',@$txt) ]; }, ); for( @joined ) { print join("\t",@$_), $/; }

- tye        

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://487168]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2020-05-29 02:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If programming languages were movie genres, Perl would be:















    Results (166 votes). Check out past polls.

    Notices?