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.
|