in reply to file parsing

You're going to have to store your data in a more complex data structure, have a read of Perl Data Structures Cookbook to give you some ideas.

The last time you ask this hdb gave you a good starting point to read the file line by in 1113317. You'll just have to deal with the duplicate entries, there are a number of ways to do it but choosing which one will depend on exactly what you need to do.