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


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

for my $y (0..(@in-1)) { for my $x (0..(@{$in[$y]}-1)) {

I'm puzzled as to why you do the subtractions to find the upper bound of the arrays rather than use the $#array that Perl provides.

for my $y ( 0 .. $#in ) { for my $x ( 0 .. $#{$in[$y]} ) {

Cheers,

JohnGG

Replies are listed 'Best First'.
Re^4: How to swap rows with columns?
by snopal (Pilgrim) on Oct 10, 2007 at 02:14 UTC

    My original did, but the second loop definition was looking like line noise and I was demonstrating the practice to a novice. So I opted for the more verbose, and less obtuse example.