note
BrowserUk
<p>Assuming that <code>$href->{$dn}->{$mail}</code> contains an array reference, then your choices are:
<code>
@{ $$href{dn}{mail} };
# or
@{ $href->{dn}{mail} };
# or
@{ $href->{dn}->{mail} };
</code>
<p>to refer to the whole array and
<code>
$$href{$dn}{mail}[0];
# or
$href->{dn}{mail}[0];
# or
$href->{dn}->{mail}->[0]; ## yawn! :)
# or ...
</code>
<p>to refer to the individual elements.
<p>However, there is a useful though slightly obscure way of simplifying the access to deeply nested structures without needing to copy data into temporary variables.
<code>
## Make the localised glob *mail
## act as an alias to the nested array
{
local *mail = $ref->{dn}{mail};
print @mail; ## Print the whole array
print $mail[0]; ## The first element
}
## *mail reverts to it's old value here.
</code>
<p>It's especially useful when you have to do a whole bunch of accesses to the elements of some deeply nested structureal element.
<div class="pmsig"><div class="pmsig-171588">
<hr />
<font size=1 >
<div>Examine what is said, not who speaks.</div>
"Efficiency is intelligent laziness." -David Dunham<br />
"Think for yourself!" - [Abigail-II|Abigail] <br />
"Memory, processor, disk in that order on the hardware side. Algorithm, algoritm, algorithm on the code side." - [tachyon]<br />
</font>
</div></div>
374917
374917