I use the below sub to write data into CSV format (using CSV::Text). I would like to write it to a file instead of the \*STDOUT. I have tried various ways to do this, all to no avail. I am sure there is a simple answer, but still being new to Perl, it is escaping me.
Any suggestions?
sub write_columns {
my $columns = shift;
if($columns->{$fields[0]}) {
$csv->print(\*STDOUT, [ map { $columns->{$_} } @fields ] );
}
}