sub transpose { my $rows = shift; my $max_col = @{ $rows->[0] } - 1; [ map { my $c=$_; [ map {($_->[$c])} @$rows ] } 0..$max_col ] }