in reply to Split line with extra delim
One might think splitting with a regex would work, like this:
but that still splits the quoted field.@x = split /"?,"?/, $chunk; # broken
Instead you can grab quoted fields and non-quoted fields, and process them separately. However, you quickly get into issues with escaped quotes, negative look-behinds, etc. It gets messy pretty quick, and difficult to maintain.
It's essentially parsing a complex syntax, so let a parser do it :)
-QM
--
Quantum Mechanics: The dreams stuff is made of
|
|---|