{
my @a = (undef) x $n;
# scope ends at closing brace
}
Normally it is not necessary to initialise an array with a certain number of elements because Perl arrays grow or shrink as necessary. Simply `my @a;` is idiomatic and will work fine.
I chose `undef` because it is the scalar value that takes the least amount of memory.
I chose `undef` because it is the scalar value that takes the least amount of memory.