#!/usr/bin/perl use warnings; use strict; use Tk; my $mw = MainWindow->new(); my $f = $mw->Frame( -border => 1 )->pack( -side => "left", -fill => "both" ); #just manipulate arrays to change lists my @list1 = ( 'a' .. 'z' ); my @list2 = ( 1 .. 100 ); my $list1 = $f->Scrolled( "Listbox", -listvariable => \@list1, -scrollbars => "osoe", -exportselection => 0, -selectmode => "extended" )->pack( -fill => 'both' ); my $list2 = $f->Scrolled( "Listbox", -listvariable => \@list2, -scrollbars => "osoe", -exportselection => 0, -selectmode => "extended" )->pack( -fill => 'both' ); $mw->Button( -text => "Selections", -command => sub { my $selected1 = $list1->get( $list1->curselection ); my $selected2 = $list2->get( $list2->curselection ); print "selected-> $selected1 $selected2\n"; } )->pack( -side => 'left' ); $mw->Button( -text => "Exit", -command => sub { exit } )->pack; MainLoop;