Welcome to the Monastery | |
PerlMonks |
How to print after using getline_hr (Text::CSV_XS)?by vagabonding electron (Curate) |
on Nov 09, 2011 at 10:19 UTC ( [id://937023]=perlquestion: print w/replies, xml ) | Need Help?? |
vagabonding electron has asked for the wisdom of the Perl Monks concerning the following question:
Dear Monks, after some experience in parsing the csv files with split & join I try to use the modul Text::CSV_XS now. I get a problem while trying to print the file if I use getline_hr. A bit of case history. I need to modify some values in some columns. These columns have always the same name (header) but the are at the different positions in the different csv files. I must therefore access these columns by names. The first script below works - because I take every column by name and combine them later. This cannot be a solution because as said the required columns can be at different positions in the different files and the number of columns can be different too. If I try it the other way the script shows an error: The error message is: Expected fields to be an array ref at ... It is correct since by using geline_hr it is hash reference not array reference. I tried it the way as [%$hr] - but no success. Your help is very much appreciated! Thanks in advance. VE
Back to
Seekers of Perl Wisdom
|
|