#!/usr/bin/perl -- use strict; use warnings; use Tk; use Tk::BrowseEntry; my $mw = tkinit; my @barvar; for my $ix ( 'A'..'C' ){ my @var = ( "", undef ); my $widget = foomanchoo( $mw, { choices => [ map { $ix.' '.$_ } 1 .. 12 ], label => "$ix label ", variable => \$var[0], } ); $var[1] = $widget; push @barvar, \@var; } $mw->MainLoop; use Data::Dump; dd \@barvar; sub foomanchoo { my ( $mw, $foo ) = @_; my $bro = $mw->BrowseEntry( -choices => $$foo{choices}, -label => $$foo{label}, -variable => $$foo{variable}, ); $bro->pack; $bro; } __END__ [ [ "A 2", bless({ _BE_buttonHack => 1, _BE_curIndex => 1, _BE_popped => 0, _BE_Style => "MSWin32", _TkValue_ => ".browseentry", }, "Tk::BrowseEntry"), ], [ "B 6", bless({ _BE_buttonHack => 1, _BE_curIndex => 5, _BE_popped => 0, _BE_Style => "MSWin32", _TkValue_ => ".browseentry1", }, "Tk::BrowseEntry"), ], [ "C 4", bless({ _BE_buttonHack => 1, _BE_curIndex => 3, _BE_popped => 0, _BE_Style => "MSWin32", _TkValue_ => ".browseentry2", }, "Tk::BrowseEntry"), ], ]