[ Duplicate post. Please ignore.]
Whoa, how did you come to think that using two steps makes it wrong. Besides, you can easily make it take one step by changing it to
my @fields = $s =~ /("[^"]*"|[^,]*)(?:,|$)/g;
Of course, there's still the question of values with quotes or newlines, space around the comma, etc. But yours didn't even attempt at handling any of those either.
The proper extraction method has not been shown
Seeing the mess that's resulting from people trying to reinvent the wheel, I'd argue I showed the proper extraction method.
|