@array1 = qw(one two); @array2 = qw(three four five); @array3 = qw(Just another Perl Hacker !); # make a 2D array my @aoa = ( \@array1, \@array2, \@array3 ); # calculate max rows ( ie find array with largest number of members ) my $max_rows = 0; for my $array_ref (@aoa) { $max_rows = @$array_ref if @$array_ref > $max_rows; } # the number of columns is the number of array refs in @aoa; my $col_num = @aoa; # we need to decide on the column width. I will use an arbitrary width and # trim the items in each column to fit if required but you could check the # length of every item first and set the width to length(longest_item) + 1 my $width = 8; my $template = '%' . $width . 's'; for my $row ( 0 .. $max_rows -1 ) { for my $col ( 0 .. $col_num -1 ) { my $item = defined $aoa[$col][$row] ? $aoa[$col][$row] : ''; # for the colums to line up we need to pack them to the same width # we will use printf to do this but you could use length and the x op # we set the $template to right justified, 8 chars wide columns # we need to trim the $item to $width -1 chars max if we want discrete # columns without items touching with no whitespace $item = substr $item, 0, $width -1; printf $template, $item; } print "\n"; } __DATA__ one three Just two four another five Perl Hacker !