in reply to Best way to search large files in Perl
First, remember that you do not need the fastest possible code. It only has to be "fast enough".
You may have to try several implementations. For my first pure perl approach, I would create a hash whose keys are the possible product IDs. Read the file one line at a time. Ignore (last if ...;) lines that would not have been kept by your first grep. Extract the product ID from each remaining line (use split, unpack, substr, or regex depending on the format of your data.) Process the line for that ID if the ID exists in the hash.
|
|---|