## This is for the main package, never do that! package main ; sub new { bless( {} , 'main') ;} sub hy { print "HELLO!\n" ;} sub DESTROY { print "DESTROY!\n" ;} my $obj = main->new ; # create the object. my $clone = $obj ; # save it in the clone. Comment this line # to see that the undef $obj works! print ">>$obj\n" ; # print the references. print ">>$clone\n" ; $obj->hy ; # test a method. undef $obj ; # lose the object. print "__END__\n" ; # End point! If you really lose # the object the DESTROY is called # before this print! Test to comment $clone.