Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^3: pushing multiple key-value pairs into an existing hash

by choroba (Abbot)
on Feb 11, 2013 at 17:45 UTC ( #1018202=note: print w/ replies, xml ) Need Help??


in reply to Re^2: pushing multiple key-value pairs into an existing hash
in thread pushing multiple key-value pairs into an existing hash

I do not undestand. __DATA__ is a filehandle. There is no method to add a filehandle's content to a hash. In your example, though, you are using

while (<DATA>) {
which seems like iterating over the filehandle line by line. What exactly do you need? Why is adding the pairs one by one or creating a temporary hash not an option?
لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ


Comment on Re^3: pushing multiple key-value pairs into an existing hash
Download Code
Re^4: pushing multiple key-value pairs into an existing hash
by lomSpace (Scribe) on Feb 11, 2013 at 18:03 UTC

    If adding a temp hash is the route then I can do that.

Re^4: pushing multiple key-value pairs into an existing hash
by lomSpace (Scribe) on Feb 11, 2013 at 18:22 UTC

    I went ahead and used the map function. Did you have something else in mind?

      Did map produce the results you want? If so, post your code, then someone can tell you if there is a better way.

      By the way, map adds the key/value pairs one by one--just like a while loop.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (12)
As of 2014-10-23 18:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (126 votes), past polls