in reply to Re: DESTROYing an object
in thread DESTROYing an object

You have to have all references to the object go out of scope. You can help this along by undefing the object reference.

Perl's garbage collection system uses reference counts--so when nothing points to a piece of data, it can be garbage collected. Note that I said can. AFAIK, there is no way to force the issue.

Check out this note in the perlobj document. Scroll up a bit to read the section on destructors. You might find it interesting, too.


TGI says moo

Replies are listed 'Best First'.
Re: Re: Re: DESTROYing an object
by Anonymous Monk on Dec 12, 2002 at 12:07 UTC
    No need to force it. As soon as the count goes to 0, Perl attempts to get rid of it. This is immediate destruction with 3 exceptions that I know of. Those exceptions are bugs, cases where counts are not tabulated immediately (happens with map) and global destruction at the end of your program.