in reply to Using Entry widget in a loop

Take reference to array element, each entry gets its own
#!/usr/bin/perl -- use strict; use warnings; use Tk; print $_,$/ for myListBox1(qw/ ro sham bo /); sub myListBox1 { my @lb = @_; my $omw = Tk::MainWindow->new; $omw->withdraw; ## no show my $mw = $omw->Dialog( -buttons => [qw/ Select Exit / ]); $mw->transient(undef); ## let dialog show even if MainWindow withd +rawn $mw->title("Custom Adjustment"); my @entries; foreach my $lab (@lb) { push @entries, ""; ## add a new one my $label = $mw->Label( -text => "$lab" )->pack(); my $entry = $mw->Entry( -textvariable => \$entries[-1], ## a reference to the last + entry -width => 30, )->pack(); } my $selectOrExit = $mw->Show; return $selectOrExit , @entries; }