If I am writing tabular output to a file as CSV, what advantage does loading an extra module
Text::CSV
and converting my data to an object get me over a basic loop and string manipulation? I have seen a couple of answers that suggest doing this: How can I get column names and row data in order with DBI in Perl and How do I create a CSV file using Perl.
Loading up an entire module seems like overkill and significant overhead for something I can write in four lines of Perl (ignoring data retrieval, etc.):
my $rptText = join(',', map { qq/"$_"/ } @head) . "\n";
foreach my $person ( @$data ) {
$rptText .= join(',', map { qq/"$person->{$_}"/ } @head) . "\n";
}
So what does loading
Text::CSV
get me over the above code?