sub selectClient { my ($dbh,$mw) = @_; my $client = undef; my @validClients = (); $mw->configure(-title=>'Duplicates'); #Create the Tk::BrowseEntry widget and bind its value to $client my $clients = $mw->BrowseEntry(-variable=>\$client, -label=>'Choose a Client'); my $button = $mw->Button(-text=>'Submit', -width=>20); $button->configure(-command=>[\&validate,\@validClients,\$client,$mw,$dbh,$button,$clients]); #Prepare statement to retrieve clients my $sth = $dbh->prepare(q{SELECT ClientCode FROM Clients WITH (NOLOCK)}); $sth->execute(); #Grab each Client while(my $rec = $sth->fetchrow_hashref('NAME_lc')) { #add it to the list of clients push @validClients,$rec->{'clientcode'}; #add it to the clients listbox $clients->insert('end',$rec->{'clientcode'}); } #Pack the widgets $clients->pack(-pady=>5); $button->pack(-pady=>5); MainLoop(); return $client; }