<html>
<body>
At 2003/06/05 08:47 AM, Sean Carte wrote:<br>
<blockquote type=cite class=cite cite>Chapter 4 of the Camel is a good
place to start, or end, or go back to<br>
repeatedly until it suddenly starts to make sense.</blockquote><br>
Oh yes! I know exactly what you mean. All the books seem to get too deep
into hashes too quick.<br><br>
My advice is to just start trying to put something in a hash and get it
out again - it will make sense eventual - I promise.<br><br>
In one of the reference books is says something like &quot;There is no
technical limit to the number of dimensions in a hash array [hashes of
hashes of hashes ...] But most human programers stop at 3&quot;<br><br>
Start simple:-<br><br>
<tt>%hash = ( <br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>car&nbsp;
=&gt; 1,<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>wife =&gt;
2,<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>dog =&gt;
4,<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>kids =&gt;
2<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>)<br><br>
print &quot;$hash{car}\n&quot;;&nbsp;&nbsp; #&nbsp; 1&nbsp; 
expected<br>
print &quot;$hash{wife}\n;&nbsp;&nbsp; #&nbsp;&nbsp; 2 expected<br><br>
$hash{dog} = 6;<br><br>
print &quot;$hash{dog}\n&quot;;&nbsp; #&nbsp; 6 expected<br><br>
$hash{dog} ++;<br><br>
print &quot;$hash{dog}\n&quot;;&nbsp; #&nbsp; 7 expected<br><br>
foreach $key (keys %hash)<br>
{<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>print
&quot;The value for key $key is $hash{$key}\n&quot;;<br>
}<br><br>
#&nbsp; The value for key car is 1<br>
#&nbsp; The value for key wife is 2<br>
#&nbsp; etc. expected<br><br>
<br>
</tt>Remember that keys are unique so you can use a hash as a unique
command.<br><br>
<br><br>
<br><br>
<br>
<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>