You will be best off doing the compare before the split but assuming you have been given the arrays and don't have access to the original data.

How large are these arrays? A naive comparison will take time proportional to N**2, I'd be inclined to convert the data into a more usable form by hash function to generate a key for each row.
my %lookup_row; foreach my $row ( @RAM ) { my $hash = hash($row); if ( defined $lookup_row{$hash} ) { push @{ $lookup_row{$hash} }, $row; } else { $lookup_row{ hash($row) } = [$row]; } } foreach my $row ( @RAM2 ) { if ( exists $lookup_row{ hash($row) } ) { # potential match # check for collision } } sub hash { # something that makes sense for your data # probably join in this case. }
For large data sets (for some definition of large) this will run faster.


In reply to Re: Finding Mismatches by hipowls
in thread Finding Mismatches by Abhisek

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.