# $csv is an instance of Text::CSV_XS # $fh is an IO::File filehandle # %data is a row of data # @outcols corresponds to the keys of %data I want $csv->combine(@data{ @outcols }) || die "choked on: '@{[ $csv->error_input ]}'\n"; $fh->print($csv->string,"\n");