Re: proposed addition to perlvar
[email protected] (David Golden)
| Newsgroups | perl.perl5.porters |
|---|---|
| Message-ID | <[email protected]> |
On Wed, Jun 9, 2010 at 10:52 AM, Matt Sergeant <[email protected]> wrote: >> my @a = ("a", "b", "c"); >> my $last_index = $#a; # $last_index is 2 >> my $last_element = $a[$#a]; # $last_element is "c" > > Do we want to "encourage" this kind of use or prefer to encourage the [-1] > format? Maybe this instead: my @a = ("a", "b", "c"); say "Element $_ is $a[$_]" for 0 .. $#a; -- David