in reply to Doing pair-exclusivity analysis and building a matrix

I can see how to present the number of things in common, but this "number of things that are different" is causing me to stumble just a bit. Comparing a,b,c,d vs x,y,z: there is nothing in common (that number is zero) - what is the difference number? 4 or 3 or what?

Update:
To find the common things, one way is to set up 2 translation hash tables like below - these can be used in combination to achieve that goal, but I am still unsure about "what difference means".

#!/usr/bin/perl -w use strict; use Data::Dump qw(pp); my %country_2_name; my %name_2_country; while (<DATA>) { s/\s*$//; # trim trailing spaces (also chomps) my ($name, $countries) = split(' ',$_,2); my @these_countries = split(/,/,$countries); $name_2_country{$name} = [@these_countries]; foreach my $this_country (@these_countries) { push @{$country_2_name{$this_country}}, $name; } } pp \%country_2_name; pp \%name_2_country; =prints { Amsterdam => ["Name4"], Canada => ["Name1", "Name2", "Name3", "Name5"], China => ["Name3"], HongKong => ["Name3"], India => ["Name2", "Name5"], Ireland => ["Name4"], London => ["Name4"], Portugal => ["Name2"], USA => ["Name1", "Name4", "Name5"], Yemen => ["Name1"], } { Name1 => ["USA", "Canada", "Yemen"], Name2 => ["Canada", "Portugal", "India"], Name3 => ["China", "HongKong", "Canada"], Name4 => ["London", "Amsterdam", "Ireland", "USA"], Name5 => ["India", "USA", "Canada"], } =cut __DATA__ Name1 USA,Canada,Yemen Name2 Canada,Portugal,India Name3 China,HongKong,Canada Name4 London,Amsterdam,Ireland,USA Name5 India,USA,Canada

Replies are listed 'Best First'.
Re^2: Doing pair-exclusivity analysis and building a matrix
by angerusso (Novice) on Mar 28, 2012 at 02:47 UTC
    Hey, THANKS SO MUCH for your quick reply and trying. I got a 2nd rpely as well which also helps. Thanks so much, perl monkers are GREAT!