http://www.perlmonks.org?node_id=963830

ghosh123 has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monk, I have the following PERL Tk code. Please tell me how can I un-bind the Button-1 ?

my $obj_A = A->new ; #creating object of A.pm my $label = $frame->Label(-anchor =>'nw', -text => 'MyLabel"); $self->{labelName} = $label; $label->bind("<Button-1>", sub { $self->onEnter($label, $obj_A) ; } )

I want to un-bind the Button-1 so that it releases the $obj_A object and its ($obj_A) refcount reduces. Assume $self is object of B.pm. Can I do something like below ? Will it serve my purpose ?

$label->bind("<Button-1>", undef );