I have a CSV file (created from a client's Excel database) that may look something like this (CSV files are just Comma Seperated Values - commas as delimiters):
Brentwood,,Y,301,2+2,,1695/mo,11/22/00,Margie,"Margie 310-455-1234, Pager 310-555-9876"
As you can see, the last field in this string actually has commas in it, and therefore it is bounded by quotes ("Margie 310-455-1234, Pager 310-555-9876"). Here is my problem - I want to be able to "intelligently split" this string. In other words, I want to split on the commas UNLESS one of the fields is bounded by quotes, as I have said. But to me, it seems like the effect before the cause - in order to tell if one of the fields is bounded by quotes, we have to seperate the string into these fields, but doing this would require spliting on commas, and BAM, I am back where I started! I thought about this:
my (...) = split(/[^"],/,$string);
But haven't had the chance to test it. What do my fellow monks think about my situation?
Thanks!!
R.Joseph