#!/usr/bin/perl use strict; use warnings; use Tk; use Tk::BrowseEntry; my $var; my $var1; my @fruits = qw( apple orange bananna grape); my @colors = qw( red orange green purple); my $widget1; # declare here so you can modify it # from first $widget my %options; $options{'Fruits'} = \@fruits; $options{'Colors'} = \@colors; #print "@{$options{'Fruits'}}\n"; my $mw = tkinit; my $widget = $mw->BrowseEntry( -label => 'Select the Journal Name:', -variable => \$var, -state => 'normal', -choices => [qw(Colors Fruits)], -browsecmd=>sub{ #print "@_\n"; my $selected = $_[1]; print "$selected\n"; $widget1->configure( -choices => $options{$var}, ); $mw->update; } )->pack( -side => 'top', -pady => '10', -anchor => 'w'); $widget1 = $mw->BrowseEntry( -label => 'Select:', -variable => \$var1, -state => 'normal', -choices => $options{$var}, #-width => 45 )->pack( -side => 'top', -pady => '10', -anchor => 'w'); MainLoop();