[Za-pm] Hashes

Spike spikeh at mweb.co.za
Thu Jun 5 07:14:31 CDT 2003


Spot on! they used to be called associative arrays.
A hash is an array of key and value pairs. The values must be scalars 
however they may be references to arrays or to hashes. (references are 
scalars).

They have a few qwerks; like you can't predict what order they will return 
values in like and array so you often need to sort on the keys a (or 
values) as you retrieve them. Keys must be unique. And they screw with your 
mind when you create hashes of arrays of hashes etc :-)

But they are powerful and you can build a whole database in one hash. You 
can even bind it a file for permanence with various modules.


At 2003/06/05 12:24 PM, Theunis De Klerk wrote:
>Hi Everyone,
>
>I'm a newbie, especially to Perl.So could someone please explain what
>hashes are and what they are used for. From what i see they are sort of
>like multi demensional arrays . Is that right?


Spike Hodge

UNIX Programmer
M-Web Technology
021 596 8496
082 901 5265

Click here and make M-Web your homepage
http://homepage.mweb.co.za 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/za-pm/attachments/20030605/015bbfa6/attachment.htm


More information about the Za-pm mailing list