Re: proposed addition to perlvar

[email protected] (Steffen Mueller)
Newsgroups perl.perl5.porters
Message-ID <[email protected]>
demerphq wrote:
>> Good point. This: "foreach (0..$#ary)" seems like a good idea to prevent
>> Obiwan errors. "$ary[$#ary]" seems a fairly unnecessary use of \W to me.
> 
> I find it moderately ironic that in the worst case $#ary /will/ return -1.
> 
> And that when it does so, this code will throw an error.

Are you sure?

perl -we 'use strict; my @a; foreach (0..$#a) {}'

is quite silent.

--Steffen
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.