in reply to Finding Mismatches

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.