in reply to How to populate a HASH using a FOR loop to a FUNCTION
With this addition, your subroutine will make a copy of the existing hash, add a key/value pair to the copy, and return the copy. Your main program overwrites the old hash with the new one. I believe that this is what you intend.my($key); my($val); my(%subHash); $key = shift @_; $val = shift @_; %subHash = %{shift @_};
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to populate a HASH using a FOR loop to a FUNCTION
by Gigiux (Initiate) on Dec 27, 2014 at 17:20 UTC | |
by BillKSmith (Monsignor) on Dec 27, 2014 at 19:11 UTC |