OC-PM: hash changing
mark
mark at web.oakley.com
Fri Jul 12 10:17:47 CDT 2002
Hi Mike,
Sure there is!
If you have a hash table that looks like:
%hash = (
key1 => value1,
key2 => value2 );
and you want to modify key2's value of 'value2' to 'some new value all
that you would need to do is access it and change the value. Something
like this:
$hash{key2} = 'some new value';
or if you just wanted to add on to the end of it you could do something
like:
$hash{key2} .= 'some new value';
which is really the same as:
$hash{key2} = $hash{key2} . 'some new value';
Hope this helps!
(feel free to post you code --this may be easier for me to help you
directly)
-Mark Mac
Michael S. Lavery wrote:
>Hey,
>
>Is there a way to edit an element in a hash table without recreating the
>whole thing? I just need to change a few values.
>
>Thanks, couldn't find the info on perlmonks or the camel book.
>
>Mike L.
>
>cya at the meeting
>
>
More information about the Oc-pm
mailing list