use strict;
use warnings;
use Text::CSV_XS;
use Data::Dumper;
my $tr_csv = Text::CSV_XS->new({ binary => 1, eol => $/ });
open(my $tr,"<",'file.csv') or die "Failure opening data file: $!";
while (my $row = $tr_csv->getline($tr)) {
print $tr_csv->status();
print @$row;
print Data::Dumper->Dump($row);
}
####
use strict;
use warnings;
open my $tr,"<",'file.csv' or die "Failure opening data file: $!";
while (<$tr>) {
my ($x,$y,$z) = split /,/;
print "x: $x\n";
}
##
##
x: ˙ūDARK01DGBBHF1D
x: DARK01JDM0HF1D
x: 191WA357Z1F811
x: 1952AF2-L3A3567
x:
##
##
use strict;
use warnings;
use Text::CSV_XS;
use File::Copy;
my $tr_csv = Text::CSV_XS->new({ binary => 1, eol => $/ });
open my $tmp,'>','tmp.csv' or die "Failure opening temp file: $!";
open my $tr,'<','file.csv' or die "Failure opening data file: $!";
while (<$tr>) {
if ($. == 1) {
$_ = substr $_,2;
}
s/\c@//g;
print $tmp $_;
}
close $tmp or die "Failure closing temp file: $!";
close $tr or die "Failure closing data file: $!";
move 'tmp.csv','file.csv';
open $tr,'<','file.csv' or die "Failure opening data file: $!";
while (my $row = <$tr>) {
$tr_csv->parse($row);
my ($x,$y,$z) = split /,/,$row;
print "x: $x\n";
}