P
Peter Ensch
Not sure if the correct word is permutation or combination (or neither), but
this is what I want to do. Given an array of arrays, such as:
my @v = (
[qw/ a /],
[qw/ b c d /],
[qw/ e f g /],
);
I want to output all the permutations/combinations from taking one item
from each array, like this:
a b e
a b f
a b g
a c e
a c f
a c g
a d e
a d f
a d g
The function should be able to handle any number of arrays with any
number of elements in each array.
This sounds easy but I'm stuck. Help!
Peter
--
^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^
Peter Ensch,
(e-mail address removed) A-1140 (214) 480 2333
^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^
this is what I want to do. Given an array of arrays, such as:
my @v = (
[qw/ a /],
[qw/ b c d /],
[qw/ e f g /],
);
I want to output all the permutations/combinations from taking one item
from each array, like this:
a b e
a b f
a b g
a c e
a c f
a c g
a d e
a d f
a d g
The function should be able to handle any number of arrays with any
number of elements in each array.
This sounds easy but I'm stuck. Help!
Peter
--
^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^
Peter Ensch,
(e-mail address removed) A-1140 (214) 480 2333
^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^