http://www.perlmonks.org?node_id=938277


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.

Replies are listed 'Best First'.
Re^3: help reassigning hash with arrayref
by GrandFather (Saint) 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.