in reply to Re: Text::CSV_XS read file from line X
in thread Text::CSV_XS read file from line X

Thanks GrandFather,

the first solution is the best and also very elegant in this case.

#!/usr/bin/perl use strict; use warnings; use diagnostics; use Text::CSV_XS; my $file = 'OR10055708.csv'; #csv file name my @rows; # array that will store csv values my $csv = Text::CSV_XS->new ({ binary => 1 }) or die "Cannot use CSV: ".Text::CSV->error_diag (); #open file open my $FH, "<:encoding(utf8)", "$file" or die "$file: $!"; #skip first n (10 in this case) lines <$FH> for 1 .. 10; #read file in while loop # my $i = 1; while (my $row = $csv->getline ($FH) ) { # if ($i > 42) {push @rows, $row;} # $i++; } $csv->eof or $csv->error_diag (); #close file close $FH; #print contents of @rows array for my $print_rows (@rows) { print "@$print_rows\n"; }