in reply to Transpose of an array
You can't transpose a two-dimensional array ($fields[][]) you haven't set up yet.
$csv->getline() reads one line from the CSV file, the column values of which you have in @fields. I.e. $fields[$y] in line 17 doesn't hold an array ref, so you can't dereference it, which is why Perl complains...
The solution would be (if the CSV data fits into memory), to read all data into memory, then transpose the resulting (two-dimensional) array, and finally write it out.
|
|---|