Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Passing a single hash to a sub
April 27, 2007, 2:35 pm
rate this thread
Re: Passing a single hash to a sub
In both cases, you're making copies of the hash. The keys/values are
copied over into a brand new hash that has nothing at all to do with
the old one.
You want to directly modify the existing hash. To do this, like your
second case, you need to use a reference. But then you can't create a
new hash using the values of the old hash. You have to directly
modify the hash that $ref references:
$ref-> = $v;
For more info, please see: