in reply to Sending a hash reference to a subroutine, and retain its values after returning from that subroutine

You're making the changes to a (shallow) copy of $hash_ref, %temp_records, which gets discarded when the subroutine ends. Just make the changes directly to $hash_ref, e.g. $hash_ref->{"foo"} = "bar";. See perlreftut and perlref for more information on using references.

  • Comment on Re: Sending a hash reference to a subroutine, and retain its values after returning from that subroutine
  • Select or Download Code