Re: hash defining
- From: shawnhcorey@xxxxxxxx (Mr. Shawn H. Corey)
- Date: Wed, 15 Mar 2006 10:20:53 -0500
Ben Marsh wrote:
%hash = ( "key" => {"key1" => value} );
To define a hash use () brackets the second hash is inserting not a hash but a
reference to a hash so you use {} brackets.
You refer to 'value' it as $hash{key}->{key1}. $hash{key} is a scalar
contains a reference pointing to a hash (so $hash{key}->{ }) and the
key is key1 (so $hash{key}->{key1}).
Regards,
Ben Marsh
You can also use $hash{key}{key1} = value; What notation you use is up to you.
--
Just my 0.00000002 million dollars worth,
--- Shawn
"For the things we have to learn before we can do them,
we learn by doing them."
Aristotle
"The man who sets out to carry a cat by its tail learns something that
will always be useful and which will never grow dim or doubtful."
Mark Twain
"Believe in the Divine, but paddle away from the rocks."
Hindu Proverb
* Perl tutorials at http://perlmonks.org/?node=Tutorials
* A searchable perldoc is at http://perldoc.perl.org/
.
- Follow-Ups:
- Re: hash defining
- From: Saurabh Singhvi
- Re: hash defining
- References:
- hash defining
- From: Saurabh Singhvi
- Re: hash defining
- From: Ben Marsh
- hash defining
- Prev by Date: DBI/SQL question
- Next by Date: Re: FW: suggestion for sftp process
- Previous by thread: Re: hash defining
- Next by thread: Re: hash defining
- Index(es):
Relevant Pages
|