igoryonya has asked for the wisdom of the Perl Monks concerning the following question:
Prints emtpy results for each record in csv file:use Text::CSV; my $csv_tie = Text::CSV->new({binary=>1}) or die "CSV doesn't work: ". +Text::CSV->error_diag(); my $csv_file = "some_file.csv"; if(open my $H_csv_file, "<", $csv_file){ while(my $row = $csv_tie->getline($H_csv_file)){ printf "(%s)\n", join(';', @$row[0..-1]); #I tried also @{$row +}[0..-1] } close($H_csv_file); }else{ print STDERR "Can't open CSV csv: $csv_file\n"; }
() () () () ()
, but, if I use some positive index number, like 0..7, for example, it works fine:(1094;СР600;7;28;42722;International;84abcdefgh0;Molokov) (1095;СР200;7;28;42722;International;84abcdefgh5;Babin) (1096;СР200;7;28;42722;International;84abcdefgh9;Rechkunova)
I've read in perl documentation about slices, it gives examples with negative numbers, so it should work?, I would suppose.
|
|---|