http://qs321.pair.com?node_id=947257


in reply to split string by comma

If your sample text reflects a true indication of your needs -- it often doesn't -- then you could use:

$s = '1945,"4,399.00",938,1/10/2012';; print for $s =~ m[("[^"]+"|[^,]+),]g;; 1945 "4,399.00" 938

For data that conforms to the original formulation of 'csv' data, rather than the bastardized corruption of that once de-facto standard that is now foisted upon us, this is all you need, and it usually runs several times faster than Text::CSV* modules.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

The start of some sanity?