You're reading in CSV data, and some of it may contain comma's and other pesky characters. I am presuming that for example, strings like location_4 would be something like "London, England" in the real data.
So use CPAN libraries such as Text::CSV to read your CSV data instead of simply reading it line by line and using split