|No such thing as a small change|
Combinations / permutations... not even sure what this is calledby tunafish (Beadle)
|on Oct 28, 2011 at 23:59 UTC||Need Help??|
tunafish has asked for the
wisdom of the Perl Monks concerning the following question:
So I'm working with a problem where I have n arrays. Let's say there are 3 of them:
I need to generate arrays containing as many elements as the last array with all possible combinations of elements from each of the arrays. So e.g.:
('red-small-1','red-small-2', 'red-small-3', 'red-small-4')
('red-medium-1','red-medium-2', 'red-medium-3', 'red-medium-4')
('red-large-1','red-large-2', 'red-large-3', 'red-large-4')
And the same thing for 'blue'.
This isn't a homework question. It's a real-life application and I've been breaking my head over this all day, even though I'm sure it can't be that complicated.
I'd really appreciate any help.