Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: help reassigning hash with arrayref

by mhearse (Hermit)
on Nov 15, 2011 at 23:25 UTC ( #938277=note: print w/ replies, xml ) Need Help??


in reply to Re: help reassigning hash with arrayref
in thread help reassigning hash with arrayref

I want to end up with:

$hash{one} = { $key => $tmp{$key} };
But for some reason the array is being assigned in scalar context.


Comment on Re^2: help reassigning hash with arrayref
Download Code
Re^3: help reassigning hash with arrayref
by GrandFather (Cardinal) on Nov 15, 2011 at 23:29 UTC

    No, that is not what you want to end up with. You may think that is what you need to do to end up with whatever it is that you want, but it's the (presumably non-working) means to an end. It would help a lot if you showed us the structure you want to end up with. What do you want to see in %hash?

    True laziness is hard work
      Thanks. You are correct. But I'm still have an issue with the array being assigned in scalar context.

        Thanks. You are correct. But I'm still have an issue with the array being assigned in scalar context.

        Um, what?

        If you don't want to make a copy, like Grandfather showed here, then simply copy the reference , meaning, forget about dereferencing.

        If that doesn't make sense, then show as asked, the data structure you're trying to create, the same way you showed your input data structure.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2014-07-14 03:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (254 votes), past polls