http://www.perlmonks.org?node_id=46542


in reply to How do I create a CSV from a 2D array?

As long as you are sure the list is two dimensional, this should work. First argument is the delimiter, second is the array. If you print the returned scalar to a filehandle, you will create a .csv file:
-------
my $write_this_to_file = delimit( ", ", @array ); sub delimit { my $delim = shift; my $delimited_file; foreach $row (@_) { $delimited_file .= join ($delim, @$row); $delimited_file .= "\n"; } return $delimited_file; }