#!/usr/bin/perl use warnings; use strict; use Tk; my @hrs = ("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"); my $mw = new MainWindow(); my $menu = $mw->Optionmenu( -options => \@hrs, -textvariable => \$hrs[0] )->pack(); $mw->Button(-text=>'Shift',-command => sub{ push (@hrs, shift(@hrs)); $menu->configure(-options => \@hrs, -textvariable => \$hrs[0] ); $mw->update; })->pack(); #start up at desired value my $desired = 3; push (@hrs, shift(@hrs)) until $hrs[0] == 3; $menu->configure(-options => \@hrs, -textvariable => \$hrs[0] ); MainLoop;