I have a 3 dimensional array. I want to set its three elements as follows:
$array[$x][$y][0 .. 2] = (0, 1, 2);
but perl tells me:
Useless use of constant (1) in void context
In the context of an array:
@array[$x][$y][0 .. 2] = (0, 1, 2);
but perl tells me:
syntax error near "] ["
supposedly means that he expects me to give him two indexes and then assign the third dimension as a separate array? However, on this page in the section Example: Assignment Using Array Slicesit is shown that you can assign a slice using the range operator, which says:
@array1[1..3] = @array2[23..25];
How can I assign a slice to such an array, or do I need to assign each index separately?
source
share