my $csv = Text::CSV_XS->new({'binary' => 1}); my $current_line; while () { $current_line .= $_; next unless ($csv->parse ($current)); my @row = $csv->fields(); $current = ''; # do stuff with the rows... }