I'm not sure I understand the situation the OP is addressing or facing. Even after looking at the various responses and the OP's comments, I'm still not sure I'm understanding. But like toolic, I would suggest that if the OP hasn't already done so, looking into and considering CPAN modules. In particular I'd suggest looking in the List:: and Set:: modules of CPAN. I have been looking in CPAN for some module to do what I *think* is similar to what the OP is seeking except that my 'bags' had limited capacity whereas. If I understand the thread for this OP's question, the OP doesn't have that limitation. Anyway, I came upon the module Set::Bag which solved my particular problem. I have found that the List:: modules and the Set:: modules have a pretty rich set of tools to handle a wide variety of Power Set, binning, permutation and combinatorial problems. I would offer that it's worth looking at the modules in those two areas (List:: and Set:: ). Unfortunately, except for Set::Bag, I really don't have any experience with any of the rest. I just saw them as I was trying to find the solution to my particular problem and once I found Set::Bag, I had no additional need to learn more.
|