Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Reference to a hash in an array of hashes

by benn (Priest)
on Aug 13, 2003 at 18:46 UTC ( #283652=note: print w/ replies, xml ) Need Help??


in reply to Reference to a hash in an array of hashes

$array[0] is already a reference to the hash. By doing $item = \$array[0], you're creating a reference to a reference. Try something like this...

$array[0]{'key'} = "testline"; $item = $array[0]; print $item->{key}; #will print "testline"
or if you prefer...
%item = %{$array[0]}; print $item{key};
Cheers,
Ben.


Comment on Re: Reference to a hash in an array of hashes
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (11)
As of 2014-08-21 17:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (139 votes), past polls