in reply to Re: Extract a column of csv
in thread Extract a column of csv

hey i did this as per your advice
my $in_file = 'C:\Documents and Settings\x0199665\My Documents\coll\t +gb.csv'; # open my $fh, '<', $in_file or die "could not open $in_file: $!\n"; my @column = map { $_->[4] } @{$csv->getline_all ($fh)};
but it gives an error "can't call getline on an unidentified value

Replies are listed 'Best First'.
Re^3: Extract a column of csv
by Tux (Canon) on Jun 26, 2013 at 14:13 UTC

    Please start reading the documentation for Text::CSV_XS or Text::CSV. To me this error indicates that you forgot to initiate the $csv object (or that you are using a very old Text::CSV):

    use Text::CSV_XS; # or use Text::CSV; my $csv = Text::CSV_XS->new ({ binary => 1, auto_diag => 1 });

    update: can I see both the script and the data? Not much has changed for getline_all () in Text::CSV_XS since Dec 2010, when it was introduced


    Enjoy, Have FUN! H.Merijn