use Text::CSV_XS; $csv = Text::CSV->new({binary => 1}); ... $csv->parse($_); @fields = $csv->fields();