for my $sheet (1..3) { my @sheet; for my $row (1..3) { my @row; for my $col (1..3) { push @col, 0; } push @sheet, \@row; } push @sheets, \@sheet; }