I have this:

   [ [ 1, 2, 3, ],
     [ 5, 6, 7, ], ]

And I want this:

   [ [ 1, 5, ],
     [ 2, 6, ],
     [ 3, 7, ], ]

How do I do that?  I mean, I can write this code:

sub reorder
{
  my $new = [];
  foreach my $col_no (0..(@{ $_[0]->[0] } - 1))
  {
    my $new_row = [];
    foreach my $row (@{ $_[0] })
    {
      push @{ $new_row }, $row->[ $col_no ];
    }
    push @{ $new }, $new_row;
  }
  return $new
}

But does anyone know a module that can do this?  Any super fast cleverness
that I don't want to even think about?

Mark.

-- 
#!/usr/bin/perl -T
use strict;
use warnings;
print q{Mark Fowler, [EMAIL PROTECTED], http://twoshortplanks.com/};

Reply via email to