<html>
<body>
<font face="Courier New, Courier"><br>
I have a hash of hashes and want to pass a reference to that HoH to a sub
routine (which we call 'print_it' for this example).<br><br>
So I go:-<br><br>
&lt;cut&gt;<br>
print_it(\%HoH);<br>
&lt;cut&gt;<br><br>
Now my problem comes when I want to de-reference the HoH
values:-<br><br>
&lt;cut&gt;<br><br>
sub print_it<br><br>
{<br>
my $hash_ref = shift;<br>
&nbsp;&nbsp; foreach $key (keys %$hash_ref)<br>
&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print &quot;$key: &quot;;<br>
# up to here all is well!<br><br>
# but I can't get the syntax to access the 'child' hash values<br>
# This does not work:-<br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; foreach $code ( keys %{ %$hash_ref{$key} }
)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #&nbsp; print
&quot;$code = %$hash_ref{$key}{$code} &quot;;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
# the problem is in the 'keys %{ %$hash_ref{$key}' bit.<br><br>
&lt;cut&gt;<br><br>
Using the hash directly the following would be valid:-<br><br>
foreach $key (keys %HoH)<br>
{<br>
&nbsp;&nbsp; print &quot;$key: &quot;;<br>
&nbsp;&nbsp; foreach $code ( keys %{ $HoH{$key} } )<br>
&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print &quot;$code = $HoH{$key}{$code}
&quot;;<br>
&nbsp;&nbsp; }<br>
&nbsp;&nbsp; print &quot;\n&quot;;<br>
}<br><br>
Any ideas on the correct syntax??<br><br>
<br><br>
</font><x-sigsep><p></x-sigsep>
<tt><font face="Courier New, Courier" size=2>Spike Hodge<br><br>
UNIX Programmer<br>
</font></tt><font face="Courier New, Courier" size=2>M-Web
Technology<br>
</font><tt>021 596 8496<br>
082 901 5265<br><br>
</tt>Click here and make M-Web your homepage<br>
<a href="http://homepage.mweb.co.za/" eudora="autourl">http://homepage.mweb.co.za</a></body>
</html>