Please post the code that you are actually running. If I run your script, I get this output:
The documentation for Text::CSV states that this is how one defines the delimiter,Can't locate method setDelimiter at rb.pl line 8.
So, here is a slightly modified version of your script.my $csv = Text::CSV->new({ sep_char => '|' });
The output is:#!/usr/bin/perl use strict; use warnings; use Text::CSV; my $csv = Text::CSV->new({ sep_char => '|' }); # create a new object my $sample_input_string = '""|""|""|""|""|""|""|""|Submit|""|""|""|GSM +|GSM|'; if ($csv->parse($sample_input_string)) { my @field = $csv->fields; my $count = 0; for my $column (@field) { print ++$count, " => ", $column, "\n"; } print "\n"; } else { my $err = $csv->error_input; print "parse() failed on argument: ", $err, "\n"; }
I'm not sure why you expect your output to be:1 => 2 => 3 => 4 => 5 => 6 => 7 => 8 => 9 => Submit 10 => 11 => 12 => 13 => GSM 14 => GSM 15 =>
as that does not seem consistent with your script or your input data.Submit|GSM|GSM => 560
In reply to Re: Need help with Text::CSV
by kevbot
in thread Need help with Text::CSV
by ravi45722
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |