use Text::CSV_XS; my $csv = Text::CSV_XS->new ({ binary => 1, auto_diag => 1 }); open my $data, "<", $file_c or die "$file_c: $!\n"; my $rows = 0; while (my $row = $csv->getline ($data)) { $rows++; } print "Total $rows rows (including header line)\n";