in reply to Resizable Matrix, or similar data structure.

Maybe you want an array(ref) of hash refs so you can use the hash key as the column name? Probably not as memory efficient as an AoA depending on empty columns.

my $ary = [ { c1 => 1, c3 => 3 }, { c2 => 2, c3 => 3, c4 => 4 }, { c5 => 5 }, ]; my @cols = qw( c1 c2 c3 c4 c5 ); # to set a vaulue in a col that may or may not exist.... $ary->[0]->{c2} = 2; # print out as a table print join " ", @cols, "\n"; for my $ref( @$ary) { print join " ", (map{ defined $ref->{$_}? $ref->{$_} : '~' }@col +s), "\n"; } __DATA__ c1 c2 c3 c4 c5 1 2 3 ~ ~ ~ 2 3 4 ~ ~ ~ ~ ~ 5

cheers

tachyon