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


in reply to How do I create a matrix?

Heh, close. :)
The trick is to use an array of array references:
my @matrix = ( [qw(0 0 0 0)], [qw(0 0 1 0)], [qw(0 1 0 0)], [qw(1 0 0 0)], ); foreach my $row (@matrix) { print join(":",@$row), "\n"; } # qw(1 0 0 0) is better way of saying (1,0,0,0)