use strict; use warnings; use Tk; require Tk::BrowseEntry; my @items = qw(first second third fourth); my $mw = MainWindow->new(); my $default_choice = "first"; my $dropDown = $mw->BrowseEntry( -label=>'items', -variable=>\$default_choice, #capture the user choice or show default -browsecmd=>\&doIt )->pack(); $dropDown->insert('end', "First"); $dropDown->insert('end',"Second"); $dropDown->insert('end',"Third"); $mw->Button(-text=>'exit', -command=>sub{exit;})->pack(); MainLoop; #check if the array has an element identical to what's been chosen.. sub doIt{ my $x = -1; foreach my $element (@items){ $x++; print $element eq lc($default_choice)? "$default_choice index \$items[$x]\n" : next; } }