<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">use Tk;
$top = MainWindow-&gt;new();
$wine_list = $top-&gt;Listbox("-width" =&gt; 20, "-height" =&gt; 5
           )-&gt;pack();
$wine_list-&gt;insert('end', # Insert at end, the following list
           "Napa Valley Chardonnay", "Cabernet Sauvignon",
           "Dry Chenin Blanc", "Merlot",
           "Sangiovese");
$wine_list-&gt;bind('&lt;Double-1&gt;', \&amp;buy_wine);

sub buy_wine {
    my $wine = $wine_list-&gt;get('active');
    return if (!$wine);
    print "Ah, '$wine'. An excellent choice\n";
    # Remove the wine from the list
    $wine_list-&gt;delete('active');
}

MainLoop();
</pre></body></html>