#! perl -slw use strict; use List::Util qw[ max ]; use Data::Dumper::SLC; my @cmat = ( [ qw[ A B C F G ] ], [ qw[ u b ] ], [ qw[ 1 T A R S 2 P] ], ); my @trans = map { my $index = $_; [ map{ $_->[ $index ] } @cmat ]; } 0 .. max map{ $#$_ } @cmat; Dump \@trans; __END__ P:\test>junk [ [ 'A', 'u', '1', ], [ 'B', 'b', 'T', ], [ 'C', undef, 'A', ], [ 'F', undef, 'R', ], [ 'G', undef, 'S', ], [ undef, undef, '2', ], [ undef, undef, 'P', ], ]