I have a Perl script that reads in a CSV file, changes the columns names of the original, adds new ones (output CSV column names are stored in the array, header_line), adds new field values for each row read, and then writes out a new CSV file.
Thanks to a comment by @harleypig on my last question, I'd like to use:
$csv_i->column_names( @header_line);
$row = $csv_i->getline_hr($fh_i)
because this lets me easily access row fields using meaningful names rather than magic numbers. For example:
$row->{ 'name' } = get_fullname($row->{ 'name' });
The only problem now is, what's the best way to write out the line? Previously, I used:
$csv_o->print( $fh_o, $row );
But that fails because it expects an array ref. How do I write out the hash ref using the csv_o object?