Thread Text::CSV_XS Fehler (2 answers)
Opened by reinhardp at 2018-09-06 09:49

reinhardp
 2018-09-06 09:49
#188890 #188890
User since
2016-01-20
7 articles
BenutzerIn
[default_avatar]
Hallo,

Ich versuche gerade mit dem Modul eine CSV Datei einzulesen, bekomme aber folgende Fehlermeldung:

CSV_XS ERROR: 1500 - PRM - Invalid/unsupported argument(s) @ rec 1 pos 0
1 at extract.pl line 11.

Mein Code:
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use Text::CSV_XS qw( csv );

my @maerkte = {'6156','6864','6875', '6255', '6030', '6130', '6579'};

my $csv_file = $ARGV[0];
# print "Hallo Welt: $ARGV[0]";
my $csv = Text::CSV_XS->new ({ binary => 1, auto_diag => 1, sep_char => ",", decode_utf8 => 1, allow_whitespace => 1 });
open my $fh, "<", $csv_file or die "$csv: $!";
while (my $row = $csv->getline ($fh)) {
if ($csv->parse ($row)) {
my @field = $csv->fields;
foreach my $col (0 .. $#field) {
my $quo = $csv->is_quoted ($col) ? $csv->{quote_char} : "";
printf "%2d: %s%s%s\n", $col, $quo, $field[$col], $quo;
}
}
else {
print STDERR "parse () failed on argument: ",
$csv->error_input, "\n";
$csv->error_diag ();
}

}
close $fh or die "$csv_file: $!";


Kann mir da bitte jemand helfen?
Danke,
Reinhard

View full thread Text::CSV_XS Fehler