alkis has asked for the wisdom of the Perl Monks concerning the following question:
as you see there is not standart number of elements in each list,although elements cannot be repeated... what i want to do is to take these lists and create all the possible combinations of these numbers... for example if i have the above lists there can be created 12 possible lists with the combination of these numbers, which are:list[1]=[1,2,6] list[2]=[4,5] list[3]=[7,3]
the number of elements in each comb[] list is equal to the number of lists (in this example 3), and in each comb[] eixsts one element of each list[] at a time... the question is how can i do that in perl??? thank you alkiscomb[1]=[1,4,7] comb[2]=[1,4,3] comb[3]=[1,5,7] comb[4]=[1,5,3] comb[5]=[2,4,7] comb[6]=[2,4,3] comb[7]=[2,5,7] comb[8]=[2,5,3] comb[9]=[6,4,7] comb[10]=[6,4,3] comb[11]=[6,5,7] comb[12]=[6,5,3]
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: combine elements of lists
by Corion (Patriarch) on Apr 22, 2008 at 13:14 UTC | |
|
Re: combine elements of lists
by jdporter (Paladin) on Apr 22, 2008 at 14:34 UTC | |
|
Re: combine elements of lists
by mscharrer (Hermit) on Apr 22, 2008 at 13:27 UTC | |
by mscharrer (Hermit) on Apr 22, 2008 at 13:51 UTC | |
by alkis (Acolyte) on Apr 22, 2008 at 13:46 UTC | |
|
Re: combine elements of lists
by grizzley (Chaplain) on Apr 22, 2008 at 13:02 UTC |