OC-PM: hash changing

Andrew Sweger andrew at sweger.net
Thu Jul 11 15:16:52 CDT 2002


On 11 Jul 2002, Michael S. Lavery wrote:

> 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.

Please excuse if I've over simplified this.

Given:

%fruit = ( Orange => "orange",
           Apple  => "red",
           Banana => "yellow",
);

Let's say you want to change the color (value) of the Apple element.

$fruit{Apple} = "white";

Is that what you're looking for? There's a couple (hundred) other ways to
do it.

-- 
Andrew B. Sweger -- The great thing about multitasking is that several
                                things can go wrong at once.




More information about the Oc-pm mailing list