You are most welcome!
By the way, with DBD::CSV you can work with flat-file databases as if they were real tables. So this means that you can use the power/ease of SQL in these. The eception here is that that one of the limitations of DBD::CSV is that it does not allow table "joins" and therefore sub-queries can be used.
And yes, you were right. I was connecting twice to the file!!
Thanks