http://www.perlmonks.org?node_id=5735


in reply to How can I split a comma-delimited string when the fields can have commas in them?

The best answer is to use Text::CSV from CPAN. Otherwise, you'll have to craft a regex which can handle obscure cases like commas between quotes, escaped quotes within quotes, and other funny stuff like that.

One possibility is:

$string =~ m!"*?([^,])"*?(?:=,)!;
  • Comment on Re: How can I split a comma-delimited string when the fields can have commas in them?
  • Download Code