Re: var watchers restricted?

[email protected] (Jochen Stenzel)
Newsgroups perl.loop
Message-ID <[email protected]>
> > > If I watch a complete hash, element modifications are not recognized.
> >
> > Correct.
>
> The is because you are modifying the SV held in that element. Perl does
> not consider this a modification to the hash itself.

Ah ... I see. But what about delete() (and adding a new element)? scalar(%hash)
changes, does this indicate Perl considers THIS a modification?

> > > If I watch an array element, assignments are recognized, but if I assign
> > > via push(), this is ignored.
> >
> > Hm.
>
> Likewise you are watching the SV which is at the point at that given time.
> push modifies the array, not the element. Likewise I would expect
> emptiny the array then modifyint the element in the array will not
> be noticed either.

Hm! This is clear. A difficult task, this var watching!

                        Jochen
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.