Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
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 making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2016-08-24 11:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The best thing I ever won in a lottery was:















    Results (344 votes). Check out past polls.