in reply to Rapid text searches
Your Mother's suggestion of using a database is likely to be the best answer, but where you want to speed up a search for multiple records using the text file you can do something like:
use strict; use warnings; my @wanted = qw(1101077781172 1101077781180 1101077781183); my %match = map {$_ => 1} @wanted; while (<DATA>) { chomp; my (@fields) = split; next unless @fields >= 3; print "$_\n" if exists $match{$fields[0]}; } __DATA__ 1101077781160 1101077783656 bothChaff 1101077781161 1101077783657 bothChaff 1101077781162 1101077783658 bothChaff ...
Prints:
1101077781172 1101077783668 bothChaff 1101077781180 1101077783676 oneDegen
|
|---|