Paul Kraus wrote:
> I have a hash of arrays. Here is a sample of one of the elements
>
> $hoa{key}=[2,somestring,someotherstring];
>
> If I where to print it like this
> print "$#{hoa{key}}"
This is invalid syntax. It needs to be $#{$hoa{key}}
> It print 2.
>
> From how I understand this $# is dereferencing and should print what
> ever is contained.
No. $# gives you the index of the last element in the array that follows.
> In a hash of arrays does it just default to the
> first element of the first array and display it?
> Why does this return 2.
Because the array referenced by $hoa{key} contains 3 elements, numbered 0,
1, and 2. The last element's index is 2.
If you want to retrieve the element at index 2 you need:
${$hoa{key}}[2]
or, the simpler
$hoa{key}->[2]
which can be further simplified to
$hoa{key}[2]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]