in reply to how to speed lookups?
A couple of other changes you might consider are using a hash to check if a line is one that should be kept, and outputting lines you want to keep immediately, rather than accumulating them all in memory:
my %validbufs = map { $_ => 1 } @validbufs; while ($line = <BUFFER>) { $searchfield=(split /\'/,$line)[1]; print $line if $validbufs{$searchfield} }
In Section
Seekers of Perl Wisdom