Handling CSV files in perl

I was writing a script to modify .CSV files (ClearQuest export results), and it was incredibly complex due to having multi-line fields (“embedded newlines” in CSV jargon).

After some struggling, I came across a built-in module (at least in ActivePerl 5.12.3) called Text::CSV_XS which basically does everything I wanted. I was able to cut my script length by about 60% and get better performance and (seemingly) bug-free results.
This module is easy to use and has good documentation.

Lesson learnt: re-inventing the wheel is not always the best course of action…


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s