I have a hash as follows:
$result{1}{1}="1-1";
$result{1}{2}="1-2";
$result{1}{3}="1-3";
$result{2}{1}="2-1";
$result{2}{2}="2-2";
$result{2}{3}="2-3";
$result{2}{4}="2-4";
$result{3}{1}="3-1";
$result{3}{2}="3-2";
I would like to be able to produce every possible combination of the sets (the first key) within this hash, i.e.
1-1,2-1,3-1
1-1,2-1,3-2
1-1,2-2,3-1
etc
The number of sets can be variable which i think is where I'm having a problem. I would normally just make concentric loops but if the number of sets is variable I'm having a tough time figuring out how to loop through the sets to give me the combinations. Any suggestions?
Thanks,
Jay
$result{1}{1}="1-1";
$result{1}{2}="1-2";
$result{1}{3}="1-3";
$result{2}{1}="2-1";
$result{2}{2}="2-2";
$result{2}{3}="2-3";
$result{2}{4}="2-4";
$result{3}{1}="3-1";
$result{3}{2}="3-2";
I would like to be able to produce every possible combination of the sets (the first key) within this hash, i.e.
1-1,2-1,3-1
1-1,2-1,3-2
1-1,2-2,3-1
etc
The number of sets can be variable which i think is where I'm having a problem. I would normally just make concentric loops but if the number of sets is variable I'm having a tough time figuring out how to loop through the sets to give me the combinations. Any suggestions?
Thanks,
Jay