I'm not sure exactly what you mean by 'summing the data' when you get the second hit on a key, but here's my first thought:
I'd consider loading up a hash, always 'summing up' the values. Do that for all of your log files. Then, you'll have a hash all populated and ready to go. You can either use DBI to insert into mySql, or you can write out to CSV and load later. (Is this a regular or a one-time event?)
PS: If you want performance, make sure you understand how your transactions work. It can make a huge difference, especially in my personal preference: SQLite.