I am trying to figure out how to compute the intersection of an
unknown number of sets, realized as key => value pairs in a hash. More
explicitly, given a hash:
%hash = (
key1 => 'value1',
key1 => 'value1',
key2 => 'value2',
key3 => 'value3',
);
%hash = (
key1 => 'value1',
key2 => 'value1',
key2 => 'value2',
key1 => 'value3',
key2 => 'value3',
key3 => 'value3'
);
For such a hash, we can percieve it as a set of sets, where a set
'name' is given by the value. Thus, for the hash above, we would have
3 sets (value1, value2 and value3). Now, i would like to compute the
intersection of the members of these sets (in this case, the
intersection would have 1 member, namely key2). One of the problems is
that i do not have an a priori knowledge of the number of sets to
compare.
I have looked at List::Compare, which i believe could be useful, but i
haven't found a solution yet :(
Please, any help would be highly appreciated!
Best, Tine
That makes no sense - you can only have one of each key since keys
are unique. If you were to add a key a second time it would replace
the prior value for that key. Hence you would have:
%hash = (
key1 => 'value3',
key2 => 'value3',
key3 => 'value3'
);
instead of what you showed above. Maybe restate your problem in
another manner.
PS: What does it have to do with Tk ?