my @items; for my $text ( qw( one two three four five six seven eight nine ten ) ) { my $label = $pane->Label( -text => $text, -anchor => 'w', -fg => '#000000', -bg => '#C0C0C0', -font => 'courier 20 normal', )->pack(-fill => 'x', -expand => 1); push @items, $label; $label->bind('' => sub { $_->configure( -bg => '#C0C0C0') for @items; #unhighlight everything $selectedtext = $text; $label->configure( -bg=>'#CCE8FF'); #highlight this } ); $label->bind('' => sub { if (${$label->cget("-font")} eq 'courier 20 normal') { $label->configure( -font => 'courier 20 bold', -fg=>'#0000FF'); } else { $label->configure( -font => 'courier 20 normal', -fg=>"black"); } } ); }