Perl: the Markov chain saw | |
PerlMonks |
Re^2: Splitting a string on commas except when inside quotesby Tux (Canon) |
on Jan 02, 2023 at 17:11 UTC ( [id://11149294]=note: print w/replies, xml ) | Need Help?? |
Though that is a perfect answer, the code you showed uses parse and thus is unsafe to use when upgrading from this easy single-line example to parsing a complete file record by record, wher getline whould be the preferred method to use. Below is an example that uses more recent Text::CSV_XS' csv function
to upgrade from this single line to the complete file
changes to
And then all is available in the $aoa
Enjoy, Have FUN! H.Merijn
In Section
Seekers of Perl Wisdom
|
|