in reply to Re: Array comparison using perl
in thread Array comparison using perl
and what happens when the number of elements increases? This code is O(n2) which doesn't scale at all well. Better is something like:
my %hits; ++$hits{$_} for @a1; my @matched = grep {exists $hits{$_}} @a2;
|
|---|