If another program is writing that file out, then you need to go to the author of that program and tell them to either learn how to create proper CSV files or pick a format that they can actually use. That line would typically have the last field quoted.
If it's always the case that the last field might have commas and the previous fields never have commas, you could do a restricted split:
my @fields = split ',', $data, 5;
I wouldn't do that, though, because you don't know what's going to change in the future. Whatever program you have creating the CSV data is writing bad data and you shouldn't have to put up with that.
Cheers,
Ovid
New address of my CGI Course.
Silence is Evil (feel free to copy and distribute widely - note copyright text)
In reply to Re: How can I read a file that is comma delimited but includes a comma in the string?
by Ovid
in thread How can I read a file that is comma delimited but includes a comma in the string?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |