Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Hash question

by Bilbo (Pilgrim)
on Jun 04, 2003 at 13:54 UTC ( [id://262985]=note: print w/replies, xml ) Need Help??


in reply to Hash question

Each entry in a hash is a scalar, so it contains just one value. However, this value can be a reference to an array. You should see perlref for details.

You can put an array reference into your hash using

$hash{key} = \@my_array; # the \ makes it a reference or $hash{ket} = [1, 23, 37];

You can put individual entries in your hash using:

$hash{key}->[0] = 1; $hash{key}->[1] = 23;

To get them out again use $hash{key}->[0] etc, or get the whole array using @array = @{$hash{key}}.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://262985]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (7)
As of 2024-04-18 13:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found