[Israel.pm] negative array indexing
yuval at windax.com
Sun Feb 15 04:40:26 PST 2004
I wanted to try it and this is what I got:
> perl -MData::Dumper -le 'my @a=(1,2,3); $a[-5]=4; print Dumper(\@a)'
Modification of non-creatable array value attempted, subscript -5 at -e
As for the first question:
> perl -MData::Dumper -le 'my @a=(1,2,3); @a=4; print Dumper(\@a)'
$VAR1 = [
So Perl isn't strict about it.
When turning on warning it warns me:
Scalar value @a better written as $a at -e line 1.
More information about the Perl