Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Hash element access -dereferenced hashes

by choroba (Bishop)
on Dec 06, 2012 at 10:10 UTC ( #1007507=note: print w/replies, xml ) Need Help??


in reply to Hash element access -dereferenced hashes

Works for me. Note I use key1 as a string, not the undefined variable $key1. Use strict and warnings to catch this kind of problems.
%hash1 = (key1 => "value1"); %hash2 = (value1 => "Gotcha"); print $hash2{ $hash1{key1} }, "\n"; # Not $key1!
Output:
Gotcha
لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1007507]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (10)
As of 2017-11-22 20:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (327 votes). Check out past polls.

    Notices?