Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Initialize an hash with string

by Eliya (Vicar)
on Jun 21, 2012 at 09:41 UTC ( #977605=note: print w/ replies, xml ) Need Help??


in reply to Initialize an hash with string

my %inp = ( KEY1 => 'VALUE1', KEY2 => { 'VALUE 21', 'VALUE 22', 'VALUE 23' } )

Note that hashes hold key-value pairs, i.e. the above structure would be more like

my %inp = ( KEY1 => 'VALUE1', KEY2 => { 'VALUE 21' => 'VALUE 22', 'VALUE 23' => undef } )

Not sure if that's what you want.  Maybe you rather want an array(ref) (i.e. KEY2 =>  [ ... ]) here?


Comment on Re: Initialize an hash with string
Select or Download Code
Re^2: Initialize an hash with string
by Anonymous Monk on Jun 21, 2012 at 09:45 UTC
    Yes, sorry I mistyped the value of KEY2 that is an array ref as you pointed out.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (9)
As of 2014-08-21 09:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (128 votes), past polls