use strict;
use Tk;
my $mw = MainWindow->new();
my $menubar = $mw->Menu(-type=>'menubar');
$mw->configure(-menu=>$menubar);
$menubar->cascade(-label => 'Datei',
-underline => 0
);
my $menu_datei = $menubar->Menu(-menuitems=>
[
['command' => 'Menupunkt1',
-command => \&callback,
]
]
);
$menubar->entryconfigure('Datei',-menu=>$menu_datei);
MainLoop();
sub callback {
my $neues_menu_datei = $menubar->Menu(-menuitems=>
[
['command' => 'Anderer Menupunt',
-command => \&callback2,
]
]
);
$menubar->entryconfigure('Datei',-menu=>$neues_menu_datei);
}