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

In reply to Re: Doing pair-exclusivity analysis and building a matrix by Marshall
in thread Doing pair-exclusivity analysis and building a matrix by angerusso

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.