in reply to Re^2: Modification of non-creatable array value attempted, subscript -1 error
in thread Modification of non-creatable array value attempted, subscript -1 error
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; "
|
|---|