in reply to DESTROYing an object

DESTROY is merely a special subroutine that is called when an object goes out of scope, but right before it is garbage collected. DESTROY is merely a convenient way to have "cleanup" code executed when your object goes away. If you set up a blank DESTROY and called it, nothing would happen.

package Foo; sub new { bless { test => 1 }, $_[0] } sub DESTROY {} package main; use Data::Dumper; my $foo = new Foo; print Dumper $foo; $foo->DESTROY; print Dumper $foo;

Cheers,
Ovid

New address of my CGI Course.
Silence is Evil (feel free to copy and distribute widely - note copyright text)