Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re^3: search a large text fileby jethro (Monsignor) |
on Feb 08, 2011 at 13:34 UTC ( [id://886963]=note: print w/replies, xml ) | Need Help?? |
This is the ideal application for a hash tied to a file. You might like to take a look at DBM::Deep. This is a well-tested and well-liked implementation of a disk based hash. Just use a script to generate your hash once (that will take a while), after that any search will be nearly as fast as a single disk access. Store multiple values either concatenated as a string or better use an array for that. Since DBM::Deep is multilevel, storing a HashofArrays is no further problem
In Section
Seekers of Perl Wisdom
|
|