5

It may be silly but I haven't found a good solution in the documentation about how to initialize a fixed array, or multidimensional array on an easy way without iterating.

my @array[10] = [0,0,0,0,0,0,0,0,0,0];
my @grid[100;100]; 

1 Answer 1

7

I'd probably use the xx operator. Something like this :

my @array[10] = 0 xx 10;
my @grid[100;100] = [0 xx 100] xx 100;
Sign up to request clarification or add additional context in comments.

1 Comment

Great, I didn't know that operator. Pretty useful though.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.