in reply to iterating 2 arrays

It's conventional and helpful for you to describe the error or problem. In this case it's evident enough, especially as leaping straight into using a hash reference instead of a hash is something of a code smell.

Change my $ref = { to my %hash = ( (and change the closing '}' of course). Remove @keys and change my $k(@keys) to my $k (keys %hash).

True laziness is hard work

Replies are listed 'Best First'.
Re^2: iterating 2 arrays
by sunil9009 (Acolyte) on Nov 29, 2013 at 04:27 UTC
    Thanks guys, I updated the existing code, its working now. Culprit was, I was using $ref{$k} instead of $ref->{$k} So dumb :-)

      Please do not just change your OP without indicating (in your OP) what you've changed.

      How to handle this situation is described in "How do I change/delete my post?" (which explains why as well as how).

      Update: While I indicated "OP" above (as that was applicable to this specific case), the information about changing the content of your post applies to any node you write.

      -- Ken

      Culprit was, I was using $ref{$k} instead of $ref->{$k}

      Nope. Unless there is more context than you are telling us, the culprit is using a hash reference instead of a hash.

      References are fine where they are needed, but require needless extra syntax where a simple variable will suffice.

      True laziness is hard work