I'm not sure what sort of source data you're looking at, or what basis there is for saying things like "A101 matches B302" and so on. But if the four arrays actually have matching values, and you want to track the distribution of values across arrays, something like this might help:
use strict; # pretend these are our four arrays: my @A = qw/we me you them us foo others folks/; my @B = qw/them I we he she it one foo/; my @C = qw/foo bar baz blah me he we she/; my @D = qw/this that another foo bar baz/; my %arefs = ( A => \@A, B => \@B, C => \@C, D => \@D ); my %distro; for my $ary ( sort keys %arefs ) { my $aref = $arefs{$ary}; for ( my $i=0; $i<@$aref; $i++ ) { my $elem = $$aref[$i]; $distro{$elem} .= sprintf( " %s%3.3d ", $ary, $i ); } } for my $elem ( sort keys %distro ) { print "$elem\t$distro{$elem}\n"; } __OUTPUT__ I B001 another D002 bar C001 D004 baz C002 D005 blah C003 folks A007 foo A005 B007 C000 D003 he B003 C005 it B005 me A001 C004 one B006 others A006 she B004 C007 that D001 them A003 B000 this D000 us A004 we A000 B002 C006 you A002
Now, you can either save the output to a file, and use other tools (or write other perl code) to do interesting things with the list, or just add some more steps in the above script, to grep for values of interest in the %distro hash -- e.g.:
my @keylist = sort keys %distro; my @hitAll4 = grep { $distro{$_} =~ /A\d+ B\d+ C\d+ D\d+/ } @keylist; my @missingD = grep { $distro{$_} !~ / D\d+/ } @keylist; # and so on.

(updated the print statement to use tabs for nicer alignment)


In reply to Re: confusing array comparison by graff
in thread confusing array comparison by Anonymous Monk

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.