in reply to size of array

You can pre-grow the array by assigning to the variable corresponding to its last index:

$#arabian_nights = 1000;
This will tell perl that you want an array @arabian_nights of size 1001, but it won't prevent perl from adding elements past the pre-grown size. You can always truncate the array to the size you want, also by assigning to its last-index variable. (In other words, the line above sets the size of the array; whether this amounts to "pre-growing" or "truncating" depends on the size of the array at the time.)

BTW, you can "pre-grow" a hash too, by assigning to keys:

keys %mongo = 1_000_000;
Pre-growing, both for arrays and hashes, makes perl more efficient, since it doesn't need to jump through memory reallocation hoops every time the array or hash grows past the space allocated to it by default.

the lowliest monk