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: $!";