#!/usr/bin/perl -w use strict; use AnyData; my %is_quoted_field = ( c1=>1, c4=>1, c5=>1 ); my @cols = qw ( c1 c2 c3 c4 c5 c6 ); my $table = adTie('CSV',[],'r',{cols=>[@cols]}); while (my $row = each %$table) { my @fields; for (@cols) { my $field = ($is_quoted_field{$_}) ? q{"} . $row->{$_} . q{"} : $row->{$_}; push @fields,$field; } print join(',',@fields)."\n"; } __DATA__ "bye",3,27.6,"green","32",stuff "x,y",5,28.2,"yellow","33",more stuff