Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Factorial Matrix

by ikegami (Patriarch)
on Jan 29, 2008 at 20:00 UTC ( [id://664972]=note: print w/replies, xml ) Need Help??


in reply to Factorial Matrix

That's a cross product, not listing permutations or combinations.

It's trivial with Algorithm::Loops's NestedLoops.

use Algorithm::Loops qw( NestedLoops ); my @array1 = qw( A B ); my @array2 = qw( 1 2 ); my @array3 = qw( C D E ); my $iter = NestedLoops([ \@array1, \@array2, \@array3, ]); while (my @row = $iter->()) { print("@row\n"); }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2025-03-24 20:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When you first encountered Perl, which feature amazed you the most?










    Results (65 votes). Check out past polls.

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.