use Tk; $mw = tkinit; $t1 = $mw->Text->pack; $t1->bind('', sub { print "foo\n\n"; $_[0]->break }); # the order of bindtags is: # class name (Tk::Text), window name, ancestral toplevel, "all" # this modifies the tag list so that the instance binding, # which includes a call to break(), has higher priority # than the class binding $t1->bindtags([($t1->bindtags)[1,0,2,3]]); MainLoop;