#!/usr/bin/perl use warnings; use strict; use Tk; my $mw = MainWindow->new(); my @opt1 = ('a'..'m'); my @opt2 = ('n'.. 'z'); my $var = 'a'; my $tvar = 'a'; my $opt = $mw->Optionmenu( -command => \&show_choice, -variable => \$var, -textvariable => \$tvar, -options => \@opt1, )->pack; $mw->Button(-text=>'Change Options',-command=>[\&change_ops, $opt])->pack; $mw->Button(-text=>'Exit', -command=>sub{$mw->destroy})->pack; MainLoop; sub show_choice { print "got: ", shift, "\n" } sub change_ops { my $op = shift; $tvar = 'n'; $op->configure( -options => \@opt2 ); }