choroba, could you please include where you got the headings/headers? You used the method new() instead of the function csv(). Since new() doesn't have a header option, I don't know where the headers are invoked if they are not the first line of the file being parsed.
As for the secondary new() splitting (or whatever does it) at ;, that would be triggered whenever a header has a + at the end of it (and the + being removing from the header after parsing). So, for example, my movies.txt has the following headers...
'headers' => ['title','start year','end year',qw(media format+ Wikiped +ia allmovie IMDb TV.com Flixster genre+ source company)],
format and genre would be parsed at the ; while all other fields are strings.
So for a file where I only want a key-value pair for each line, it looks like I will have to put in 2 headers, and if the second one has a + it is to be parsed with the value being split (or whatever) on the ;.
I gravitated directly to csv() because it looked easier to use than new() since I could not figure out what did what. Like what makes an array of hashes and what makes a hash of hashes (what I use mostly). The whatchamacallits (like getline, parse, etc) are not grouped together in such a way as to make it obvious to me.
So, would you please expand the code so I can see everything you are doing? I am a bit lost.
In reply to Re^2: Can Text::CSV_XS return key-value pairs?
by Lady_Aleena
in thread Can Text::CSV_XS return key-value pairs?
by Lady_Aleena
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |