Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re: All Combinations of three arrays.

by halley (Prior)
on Aug 26, 2005 at 16:40 UTC ( #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?

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2023-01-28 10:14 GMT
Find Nodes?
    Voting Booth?

    No recent polls found