LanX has asked for the wisdom of the Perl Monks concerning the following question:
I'm struggling to find the perldocs where the usage of $# (i.e. last-index) with array-references (not symbols) is documented. Can you help me?
If not, what's the best place to augment the perldocs?
Tested behavior (5.10):
DB<107> @a = (1..5) # @array => (1, 2, 3, 4, 5) DB<108> $#a # classic usage => 4 DB<109> $a = [1..10] # arrref => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] DB<110> $#$a => 9 DB<111> $a = [ map [0..$_],0..3 ] # AoA => [[0], [0, 1], [0, 1, 2], [0, 1, 2, 3]] DB<112> $#{ $a->[2] } => 2
Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Where is $# fully documented?
by ikegami (Patriarch) on Sep 23, 2014 at 14:34 UTC | |
|
Re: Where is $# fully documented? (rqr)
by tye (Sage) on Sep 23, 2014 at 15:07 UTC | |
by LanX (Saint) on Sep 23, 2014 at 16:19 UTC | |
|
Re: Where is $# fully documented?
by ysth (Canon) on Sep 23, 2014 at 14:24 UTC | |
by LanX (Saint) on Sep 23, 2014 at 14:44 UTC | |
by ysth (Canon) on Sep 23, 2014 at 17:25 UTC | |
by LanX (Saint) on Sep 24, 2014 at 09:43 UTC | |
by ikegami (Patriarch) on Sep 24, 2014 at 13:05 UTC | |
by ikegami (Patriarch) on Sep 23, 2014 at 14:48 UTC | |
|
Re: Where is $# fully documented?
by RedElk (Hermit) on Sep 23, 2014 at 14:40 UTC | |
|
Re: Where is $# fully documented?
by toolic (Bishop) on Sep 23, 2014 at 14:12 UTC | |
by LanX (Saint) on Sep 23, 2014 at 14:20 UTC |