Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
My first thought would be to put the data into an actual database (even something like DBD::SQLite), then query it (but that does not appear to be a route you are looking into). Is the data in the file sorted on the first number in the row? If so, then one method you might consider is to take a portion of that number (for example, the first 5 digits), and use the tell() function to record the first and last line matching that portion of the number. Then, you would enter the number you are seeking, the "index" lookup would tell your script where to start/stop looking, and it would seek() to the starting location of the main file, then examine the records only to the stop location. (This might work with unsorted records as well, although the degenerate case would be that the first and last entry in the main file matched the search criteria.) Hope that helps. In reply to Re: Using indexing for faster lookup in large file
by atcroft
|
|