Beefy Boxes and Bandwidth Generously Provided by pair Networks Cowboy Neal with Hat
laziness, impatience, and hubris
 
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 having an uproarious good time at the Monastery: (5)
As of 2014-04-20 11:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (485 votes), past polls