Let's also accept your agument that it doesn't behave any differently than $array[42] as an rvalue.I offer that it is a fact that a (even slightly) seasoned Perl programmer will instinctively use the $array[42] notation.
Then is there any argument you can make against warning about it when used as an rvalue (but not lvalue)?
The fact that most Perl programmers will prefer $array[42] over @array[42] is partially habit, but it's also influenced by this warning being discussed. Seasoned Perl programmers will use warning, if only during development, and if a programmer has two options of doing something, and one option issues a warning, which option do you think will be mostly used?
Let's not forget that Larry himself decided that $array[42] isn't right, and that it's now going to be @array[42] in perl6. Should then perl5 warn? I don't think so.
Furthermore, if you accept that (at least in rvalue context), both @array[42] and $array[42] are the same, why should there be a warning for one? If you cannot make a mistake, why suggest to the programmer he could have made one?
Abigail
In reply to Re: @array[1] is valid??
by Abigail-II
in thread @array[1] is valid??
by jdklueber
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |