in reply to UPDATED: Forking On Foreach Keys In Hash, Passing Hash To Sub, And Speed/Efficiency Recommendations

You need to dereference the hashref in your subroutine.

$hashref{$key} = $npanxxcnt;

needs to be:

$$hashref{$key} = $npanxxcnt;

or

${$hashref}{$key} = $npanxxnct;

Also, your subroutine returns values but they are not stored anywhere in the calling program.

1 Peter 4:10
  • Comment on Re: Forking On Foreach Keys In Hash, Passing Hash To Sub, And Speed/Efficiency Recommendations
  • Select or Download Code

Replies are listed 'Best First'.
Re^2: Forking On Foreach Keys In Hash, Passing Hash To Sub, And Speed/Efficiency Recommendations
by Anonymous Monk on Aug 09, 2014 at 00:20 UTC
    Personally, I find
    $hashref->{$key} = $npanxxcnt;
    to be a more palatable form.