Does that mean you disagree with the warning?
It's meant to enforce style, but I agree with the style being enforced, and it can detect typos (refactoros?).
Or are you like the ancient Greek who didn't consider 1 not to be a proper number, and you don't consider one-element lists to be proper lists?
Do you honestly think in terms of lists when you do $a[4]? I don't.
But sometimes, the slice one wants is just one element.
Of course. I didn't mean to imply otherwise. Note that Perl doesn't warn when you don't use a constant.
$ perl -wle'my @a = qw( a b c ); my @i = 2; print @a[@i]' c
In fact, using $ wouldn't work in that situation.
$ perl -wle'my @a = qw( a b c ); my @i = 2; print $a[@i]' b
I can't figure out what you think I was saying, but hopefully this clears it up.
In reply to Re^3: What is the difference between $array[1] and @array[1]?
by ikegami
in thread What is the difference between $array[1] and @array[1]?
by vinoth.ree
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |