hi monks ,i seek for some wisdom...
my script generates a list of lists with number like these below:
list[1]=[1,2,6]
list[2]=[4,5]
list[3]=[7,3]
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:
comb[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]
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
alkis
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.