#! /usr/bin/perl use strict; use warnings; use Tk; my $mw = MainWindow->new(); my $frame = $mw->Frame()->pack(); my $menu = $frame->Menu(-type => 'menubar'); $menu->cascade(-label => 'test'); my $menitem = $menu->Menu(-tearoff => 0); my $item = $menitem->command(-label => 'test2',-command => sub{print "yes";}); $menu->entryconfigure('test',-menu => $menitem); MainLoop;