"Does that clear things up?"

yes, very much so...thank you...=)

-- christopher

On Sunday 21 December 2003 10:39 pm, James Edward Gray II wrote:
> Perl uses a reference counting system.  That usually does the right
> thing, like most things Perl.  It's not magic, but it sure is handy.
> Let's look at an example.
>
> If I have an object A, which contains a reference to object B, which
> contains a reference to C, etc:
>
> A has a B has a C ...
>
> Now if A is the only top level reference in my currently running code
> (and no other code has references), what happens when we do:
>
> A = undef
>
> Object A's ref count just hit zero, so it's gone.  Now when that
> garbage collection happens, B's count is reduced, since A's reference
> to it is reclaimed.  If it hits zero too, B will be collected.  That
> would reduce C's count...  You get the idea.
>
> Basically, you generally only need to worry about Perl's references
> when you create circular refs.  When faced with that, break the chain
> yourself manually or use weak references.
>
> Does that clear things up?
>
> James

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to