my $menub = $mw->Menubutton( [ option => value ] );Some basic options are
#!perl # file menu.pl use Tk; use strict; use warnings; my $mw = MainWindow->new; $mw->title('Menu'); my $menub = $mw->Menubutton( -text => 'Menu', -menuitems => [ ['command' => 'Hello', -command => [\&print_it, 'Hello']], ['command' => 'Bonjour', -command => [\&print_it, 'Bonjour']], '-', ['command' => 'Goodbye', -command => [\&print_it, 'Goodbye']], ]); my $exit = $mw->Button(-text => 'Exit', -command => [$mw => 'destroy']); $menub->pack; $exit->pack; MainLoop; sub print_it { my $string = shift; print "You chose '$string' ...\n"; }whose window appears below.
The '-' entry in the -menuitems option is used to
insert a separator between the preceding and following menu item.