If the array is empty, then -1 goes to -1 which cannot exist
If the array is not empty, then -1 goes to the last element (it exists)
$ perl -Mdiagnostics -e " my @f; $f[-1] = 0; " Modification of non-creatable array value attempted, subscript -1 at - +e line 1 (#1) (F) You tried to make an array value spring into existence, and th +e subscript was probably negative, even counting from end of the arr +ay backwards. Uncaught exception from user code: Modification of non-creatable array value attempted, subscript + -1 at -e line 1. $ perl -Mdiagnostics -e " my @f = 0; $f[-1] = 0; "
In reply to Re^3: Modification of non-creatable array value attempted, subscript -1 error
by Anonymous Monk
in thread Modification of non-creatable array value attempted, subscript -1 error
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |