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


in reply to Re: How to swap rows with columns?
in thread How to swap rows with columns?

Isn't this so much easier to understand?

#!/usr/bin/perl use warnings; use strict; my @in = ([1,2,3,4,'a','b','c'], ['z','y','x','w',9,8,7], ['e','f','g','h',5,4,6], ); my @out; for my $y (0..(@in-1)) { for my $x (0..(@{$in[$y]}-1)) { $out[$x][$y] = $in[$y][$x]; } }

No need to be a Perl geek to do this right! And think of the ease of maintenance!