Keep It Simple, Stupid | |
PerlMonks |
Re: But I want null values in my arrayby kcott (Archbishop) |
on Mar 11, 2020 at 19:51 UTC ( [id://11114144]=note: print w/replies, xml ) | Need Help?? |
G'day sidmuchrock, I looks like you might be working with CSV data. If that's the case, Text::CSV already does what you want (if you also have Text::CSV_XS installed, it will run faster). Text::CSV also solves many other issues you might encounter with CSV data; e.g. fields containing the separator character, such as 800,900,"1,000". Unless you're doing this as a purely academic exercise, this really isn't a wheel you should be reinventing. Here's a quick example. I used your posted data and added a bit more to show some features, including: just one, zero-length element; and the embedded separator character I showed above.
Output:
— Ken
In Section
Seekers of Perl Wisdom
|
|