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

Use join on multi-dimensional array

Thread Next
From:
Bill Harpley
Date:
February 27, 2009 05:21
Subject:
Use join on multi-dimensional array
Message ID:
E9043B5743A3A843B710B9E81A84CFFF031AE863@esealmw121.eemea.ericsson.se
Suppose I have a multidimensional array of the form:

@array[names][values]

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 !

Regards,
BiLL





Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About