Perl tK Listbox question/help?

I have the very basic perl script that has a tk list box that is populated by an array. The screen also has a button that calls a function. When the button is pressed I need the items or items that are selected in the list box to be populated into another array. I'm terrible with tK and can't figure out how to do it. Does anyone know how to do this? Hoping its pretty simple. Thanks!

use Tk;

$mw = MainWindow->new;
@choices = qw/dog cat fish bird/;
my $lb = $mw->Scrolled("Listbox", 
	-scrollbars => "osoe", 
	-selectmode => "multiple"
	)->pack(-side => "left");
$lb->insert("end", sort @choices);
$mw->Button(-text => "Selection To Array", -command => sub { &FillArray })->pack;

sub FillArray {

    my @ArrayItems;
    print "Code goes here.";


Open in new window

Who is Participating?
KGNicklAuthor Commented:
my @stuff = $$lb->get($lb->curselection( )) );

Then I just loops through the @stuff array and did a pack to add them into my own array 1x1. Not sure if its the best way, but it works and got the job done.
KGNicklAuthor Commented:
Submitted before I went to sleep. When I woke up and no one had answered I just did some digging and figured out my own answer/solution to my question.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.