This is really begging for a database at this point. Most of them come with a massloader utility that will read your flatfile and dump it straight into a table. I'm quite sure you can rephrase your examination needs for this data in SQL queries rather than Perl data structures. A huge bonus is that the database approach scales much better as well - if you need to mine for a different relation in your data, it's just a matter of writing another SELECT, and if you've properly chosen which columns to index, you'll usually get your results back very quickly. Relational databases were invented to handle this kind of thing.