in reply to Separating hashed data into subsets
I do not really understand what you need %used for, but I would calculate the maximum distance like this:
for (my $i = 0; $i < 50; $i++) { #loop over array of hashes (each subs +et will have 50 keys) my $max = 0; # assuming distances are positive... foreach my $key1 (keys $subsets[$i]) { #5 keys at each level foreach my $key2 (keys $subsets[$i]) { #5 keys at each level next unless exists $distance{$key1}{$key2}; my $dist = $distance{$key1}{$key2}; $max = $dist if $dist > $max; } } # do something with $max... }
|
|---|