#!perl -w use strict; use Text::CSV_XS; use IO::File; my $csv = Text::CSV_XS->new( {binary=>1} ); my $fh = IO::File->new('myfile.csv'); my $count = 0; while (my $cols = $csv->getline($fh)) { last unless @$cols; print ++$count . ". @$cols\n"; }