my @sugs; @sugs=&suggestcomb($gotfile); #print "@sugs\n"; my $top = new MainWindow; my $lsugs=@sugs; #print"\nThe length of the array:"; #print "\n$lsugs"; $opt1="$sugs[0]"; $opt1='Nil' if !$opt1; #print "\n$opt1"; $opt2="$sugs[1]"; $opt2='Nil' if !$opt2; #print "\n$opt2"; $opt3="$sugs[2]"; $opt3='Nil' if !$opt3; #print "\n$opt3"; $opt4="$sugs[3]"; $opt4='Nil' if !$opt4; #print "\n$opt4"; my $l = $top->Label(-text => "Press right button\nfor popup menu.")->pack; my $m = $top->Menu(-tearoff => 0,font => "{arial} 12 {bold}",-menuitems => [ [Button => "$opt1", -command => \&replace1], [Button => "$opt2", -command => \&replace2], [Button => "$opt3", -command => \&replace3], [Button => "$opt4", -command => \&replace4], ] ); $top->bind("" => sub { $m->Popup(-popover => "cursor",popanchor => 'nw') }); } 1;