my @array = (undef) x $size[0]; $_ = [ map { [(0) x $size[2]] } (undef) x $size[1] ] for @array;