finding the last element in a referenced array

From: .rhavin (rhavin_at_shadowtec.de)
Date: 10/05/04


Date: 5 Oct 2004 08:37:38 -0700

i searched the usenet for a while and i wasn't able to find something
useful. perhaps i looked in the wrong places or i am to stupid -
whatever... here's my problem:

i want to access the last elemt of an array... sounds like $#array, i
know, but in my case, the array is stored as a reference in a
construction like this:

$hash{'%1'}{'%2'}=[1,2,3];

i can access the last element by

$hash{'%1'}{'%2'}[2]

cos i know it is the second, but i need a way to access the last
element without knowing whether it is the first, or the zeroth or
whatever.

i tried

$hash{'%1'}{'%2'}[$#hash{'%1'}{'%2'}]

but it doesn't work this way...

anybody willing to help, explain the mystics or simple
answer-pointing?