http://qs321.pair.com?node_id=643794


in reply to How to swap rows with columns?

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.