|Welcome to the Monastery|
How to make buckets of like databy PRyanRay (Novice)
|on Feb 05, 2013 at 19:26 UTC||Need Help??|
PRyanRay has asked for the
wisdom of the Perl Monks concerning the following question:
I am attempting to "bucketize" binary lists. The basic idea is if I have a list like this:my @array = (["A","B"],["C","D"],["A","C"],["E","F"],["F","G"]);
I would like to (using hases or arrays) bucket letters that are associated. In this example, I would like to have an object like this:my @array1 = ([A,B,C,D],[E,F,G]);
I have not had much luck. I have some code that is close but it is very clumsy and cumbersome. Here is the "meat" of my code that is attempting to do this. The variables $req1 and $req2 are the letters in the above example, and, yes, I know it is not correct, that is why I am here:
Am I missing something simple here? Any help would be appreciated.
The output from this is the following:
See the problem is how to do the retroactive updating if a new hash entry was made.