Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
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.

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 exploiting the Monastery: (6)
As of 2016-06-25 13:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred method of making French fries (chips) is in a ...











    Results (325 votes). Check out past polls.