Your code is working at a low level with many perl instructions. Your code becomes much simpler and should become a lot faster when using C based modules. DBD::CSV seems to be the way to go. I suspect that you have to use the other fields somewhere else.