in reply to Reg: Performance
Just load DUMP_B into a hash and then go over DUMP_A using the hash for fast lookup.
The unique number can have more than one account number
To cope with that you will have to use a hash of arrays:
# untested! my %b; open(B, "<" . DUMP_B) || die("Could not open file \n"); while (<B>) { chomp; my ($id, $ac) = split /\|/, $_; push @{$b{$id}}, $ac; } open(A, "<" . DUMP_A) || die("Could not open file \n"); while(<A>) { chomp; my $ac = $b{$_} || []; print "$_: ", join(', ', @$ac), "\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Reg: Performance
by sivaraman (Initiate) on Oct 29, 2010 at 04:31 UTC | |
|
Re^2: Reg: Performance
by sivaraman (Initiate) on Oct 28, 2010 at 10:12 UTC | |
by happy.barney (Friar) on Oct 28, 2010 at 10:17 UTC | |
|
Re^2: Reg: Performance
by sivaraman (Initiate) on Oct 29, 2010 at 06:34 UTC | |
by salva (Canon) on Oct 29, 2010 at 08:14 UTC | |
by sivaraman (Initiate) on Oct 29, 2010 at 12:57 UTC |