Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: All Combinations of three arrays.

by halley (Prior)
on Aug 26, 2005 at 16:40 UTC ( [id://486917]=note: print w/replies, xml ) Need Help??


in reply to All Combinations of three arrays.

Normally I would try to figure this out, but I'm in a hurry and so i have to ask for assistance.

You're a long-standing monk here; is this the attitude that you like to find at the front gate every day? It probably took you more time to type up your example than it would to code the solution.

For the fixed-number-of-columns case, just nest loops.

my $struct = [ [], [], [] ]; for my $A (@{$struct->[0]}) { for my $B (@{$struct->[1]}) { for my $C (@{$struct->[2]}) { ... } } }

For the variable-number-of-columns case, a recursive solution or a stack iteration would work.

--
[ e d @ h a l l e y . c c ]

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (3)
As of 2024-04-26 06:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found