SPUG: last index array reference's referent

jerry gay jerry.gay at gmail.com
Sun Jan 21 15:45:06 PST 2007


On 1/21/07, Michael R. Wolf <MichaelRWolf at att.net> wrote:
> # Is there a more elegant way to get the equivalent of $#seasons if
> # all you have is a reference?  Somehting that would do to references
> # what $# does to arrays....
>
sure! use C<$#$seasons>

perl -Mstrict -Mwarnings -e'my $a=[1,2,3]; print $#$a;'
2

~jerry


More information about the spug-list mailing list