use Text::CSV; my $csv = Text::CSV->new({binary=>1, always_quote=>1, blank_is_undef=>1, eol=>$/, auto_diag=>2}); $csv->print(select, ['foo', 'bar']); __END__ "foo","bar"