An array allows storing an ordered set of values accessible by numerical indices. An array is created automatically when assigning values to a variable in the following manner:
$name[value1;value2;...;valueN]
You can also create an empty array (^array::create[]) and make a copy of another array or hash (^array::copy[$another]).
Retrieving the value of an array element by index:
$name.index
Expressions can be used as indices, for example:
$name.(2+2)
Assigning a value to an array element:
$name.index[value]
$name.($i*2)[value]
If all elements in the array are defined (from the zeroth to the last), a regular array is created. However, you can initialize only a part of the elements, resulting in a sparse array (with "holes"). This feature makes the array fully compatible with a hash containing numeric keys. Arrays allow creating multidimensional structures where the values of array elements are other arrays or hashes: