in reply to matching large arrays then updating
From the sounds of it, you have two AoAs like the following:
my @array1 = ( [ id1, ... 169 other fields ... ], [ id2, ... 169 other fields ... ], ... ~200k other records ... ); my @array2 = ( [ id2, ... 169 other fields ... ], [ id5, ... 169 other fields ... ], ... ~50k other records ... );
Start by making it easy to find records in array2.
my %array2 = map { $_->[0] => $_ } @array2;
Then the problem becomes trivial.
for my $array1_rec (@array1) { my $array2_rec = $array2{ $array1_rec->[0] } or next; ... Change @$array1_rec based on values from @$array2_rec ... }
You don't actually need to create @array1 or @array2.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: matching large arrays then updating
by devan999 (Initiate) on Oct 21, 2011 at 19:00 UTC | |
|
Re^2: matching large arrays then updating
by devan999 (Initiate) on Oct 24, 2011 at 16:44 UTC | |
by ikegami (Patriarch) on Oct 24, 2011 at 22:36 UTC |