use Text::CSV_XS; my $csv = Text::CSV_XS->new ({ binary => 1, sep_char => "\t", auto_diag => 1 }); my @headers = $csv->header ($in); # Read the docs, there are options possible here while (my $row = $csv->getline ($in)) { # ... } #### use Text::CSV_XS qw( csv ); use PerlIO::via::gzip; my $aoa = csv (in => "test.csv.gz", encoding => ":via(gzip)");