Assuming the same number of fields on every row of the data file,
my @data; while (<>) { my @fields = split ' '; for my $row (0..$#fields) { push @{$data[$row]}, $fields[$row]; } }
Tested.
In reply to Re: How to swap rows with columns?
by ikegami
in thread How to swap rows with columns?
by perl_geek
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |