in reply to very slow processing
When you make the first pass, instead of pushing each ID into an array then filtering out duplicates, use a hash with ID as the key. For the value, concatenate your formatted output. For the second pass, loop on the keys of the hash, printing the strings in the hash:
my $lnum = 0; for my $line (@lines) { $line =~ /your regex/; my $date = $1; my $id = $2; my $keyword = $3; $urecs{$id} .= "$date,$id,$keyword \n"; } print $urecs{$urec} for my $urec (keys %urecs);
Displamer: Not tested.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: very slow processing
by sandy105 (Scribe) on Aug 20, 2014 at 18:37 UTC | |
by RonW (Parson) on Aug 20, 2014 at 23:17 UTC |