#!/mu/bin/perl use Tk; use strict; use warnings; my @selections; my @choices = ("choice1", "choice2", "choice3", "choice4", "choice5", "choice6", "choice7", "choice8"); my $mw = MainWindow->new(-title=>"ListBox"); $mw->Label(-text => 'Select your choices')->pack(); my $lb = $mw->Listbox(-selectmode => 'extended'); $lb->insert('end', sort @choices);$lb->pack(); $mw->Button(-text => 'Select', -command => sub {@selections = $lb->curselection;$mw->destroy;})->pack(); MainLoop; foreach (@selections) { print $_."\n"; }