#!/usr/bin/perl use Tk; use strict; my $mw=tkinit; my $text=$mw->Text->pack; my $textmenu=$text->menu; #get the menu associated with 'File' my $filemenu=$textmenu->entrycget('File',-menu); #Delete the 'Exit' command $filemenu->delete(0); #Replace it with your own $filemenu->insert(0,'command',-label=>'Press Me', -command=>sub{print "I was pressed\n"}); #Get the menu associated with 'Edit' my $editmenu=$textmenu->entrycget('Edit',-menu); #Delete the 'Cut' command $editmenu->delete('Cut'); MainLoop;