The most likely much faster way instead of using the smartmatch operator is to tell Perl that you'll be looking up things in the smaller array very often by converting the smaller array to a hash:
my %seen; $seen{ $_ } = 1 for @data; foreach my $rawData (@rows) { if( $seen{ $rawData } ) { # don't do anything, already in array } else { push(@data,$rawData); $seen{ $rawData } = 1; } }
In reply to Re: Fastest way to merge (and de-dup) two large arrays?
by Corion
in thread Fastest way to merge (and de-dup) two large arrays?
by technojosh
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |