[Chicago-talk] parsing lines

Steven Lembark lembark at wrkhors.com
Fri May 3 13:40:30 PDT 2024


On Wed, 24 Apr 2024 15:00:21 -0500
Jay S <me at heyjay.com> wrote:

> Hi no worries.
> Like I said in playing with the data it became harder to do the
> parsing I needed.
> long story short, I requested (and was given) the data in CSV

Make your life easier: Choose a delimeted format (CSV is recursive). 

Pick something other than a ',' for the separator: '|' is usually a
good choice. At that point you don't need to deal with escaped 
separators, quoted escapes of escaped quotes of separators... blech. 

Your entire input process becomes:

    my @fieldz  = split $sep => $input; 

and you're done. 

If the raw input doesn't include literal tabs, tab separated ("TSV")
is common and makes it easy to look at the files using *nix command
line tools like cut and grep. 



-- 
Steven Lembark
Workhorse Computing
lembark at wrkhors.com
+1 888 359 3508


More information about the Chicago-talk mailing list