#... code my $id = $sel || (@ids && $ids[0]) || ''; print "id 1 is <$id>\n"; my $IDText = $dlg->add ( 'JComboBox', -mode => 'readonly', -selectcommand => [\&changeEditPlayer, \$id], -validate => 'match', -textvariable => \$id, ); print "id 2 is <$id>\n";