Create hash array from other array and create csv file with new data.
Posted on 2011-04-19
I did some disk usage calculations and added the results into an array. So now I have an array that looks like this:
du_out = 185 MB /foo/bar/
du_out = 100MB /foo/bar/text.file
du_out = 85MB /foo/bar/other.txt
I want to create a csv file with that array using the Text:CSV module. Not really a necessity to use it I just thought it'd be easier with the module. Anyway, I want each row of the csv file to have the size in the first column and the name in the second column.
I'm not sure how to separate the size and name from each element. Do I have to first create a hash array from the above? Is there a way to parse it straight into the csv?
Any help is appreciated. Thanks.