It strikes me as odd that you split on comma (,) but in your data the delimiter is the pipe (|) symbol. Maybe it would speed up things to use that instead.
Otherwise, since your wording is SQL-speech, you might feel more at home using actual SQL on your CSV text files -- if that is what you prefer -- and go for DBD::CSV (and DBI)
I for myself have been happiest with the modernised Text CSV approach found in Text::CSV_XS or Text::CSV.
Créateur des bugs mobiles - let loose once, run everywhere.
(hooked on the Perl Programming language)