in reply to switch columns and rows
It's really just a matter of inverting the order of the indexes.
From an earlier thread (How to swap rows with columns?),
my @data; while (<>) { my @fields = split ' '; my $col = $. - 1; for my $row (0..$#fields) { $data[$row][$col] = $fields[$row]; } }
Tested.
|
|---|