$fields[$y] is value of one of the fields of the current rec/line, but you're trying to use it as an array (@{$fields[$y]}).
Something is very wrong with your approach since you're printing before reading the entire file, but you don't have the information you need for the first row before you read the entire file.
Solution:
my @transposed; while (my $row = $csv->getline($FILE1)) { for (0..$#$row) { push @{ $transposed[$_] }, $row->[$_]; } } $csv->print($FILE2, $_) for @transposed;
In reply to Re: Transpose of an array
by ikegami
in thread Transpose of an array
by bluray
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |