man perlref is missing critical mention of how to combine $$ and $#:
$ perl -lwe 'use strict; my @m=1..11; my $arrayref = \@m; print $#m; print $#$arrayref'
10
10
By the way, curious as to where $# itself is documented, on man perlvar we see
...not the sigil you use in front of an array name to get
the last index, like $#array. That's still how you get the
last index of an array in Perl...
but apparently no better mention in all of the perl man pages.
jidanni@jidanni.org writes: It's documented in perldata under Scalar Values, about seven paragraphs down. (And yeah, it's not horribly easy to find.)
RA> It's documented in perldata under Scalar Values, about seven paragraphs
RA> down. (And yeah, it's not horribly easy to find.)
Ah, right near where he mentions csh (wonder how many kids know what that is).
P.S.
Besides discovering I could use $#$$, I now also find $#{$$ ... works,
use Data::Dumper; die Dumper ($#{$$p{$g}{members}{data}},$$p{$g}{members}{data}[0]);
so also document that too please there on perlref. Yes it is starting to look !@#$ing ugly!