On Fri, 17 May 2002 17:10:53 +0300 (EEST)
Viljo Marrandi <[EMAIL PROTECTED]> wrote:

: $vars->{'key2'} = "value of second key";

The hash $vars points to has a key named "key2".

: $vars = {
:     xxx => "AAA",
:     yyy => "BBB",
:     zzz => "CCC",
: };

Now you change the reference stored in $var. It points to an entirely
new hash, whose keys are "xxx", "yyy" and "zzz".

: $vars->{'key1'} = "value of first key";

Here you add the key "key1" to the hash $vars points to.

: Problem is, that value of key2 is lost after I set values to xxx, yyy and
: zzz, but key1 is ok.

$vars contains a reference to a hash that has nothing to do with the
first one, you didn't create a key named "key2" in that hash.

-- fxn

Reply via email to