develooper Front page | perl.beginners | Postings from February 2009

Use join on multi-dimensional array

Thread Next
Bill Harpley
February 27, 2009 05:21
Use join on multi-dimensional array
Message ID:
Suppose I have a multidimensional array of the form:


For example, I have a list of database field names and the value
associated with each one.

If this was a single dimensional array called @list, I could create an
output line in CSV format by using the 'join' command like this:

$line= join ',' , @list;

Is there a simple way to just take a single column of a multidimensional
array and use 'join' to create a CSV output line?

Must I copy the desired column into a single dimensional array first?
This is the most obvious way but if anybody can think of a neater trick
I would be delighted to know !


Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About