#!/usr/bin/perl use strict; use warnings; use Tk; use Tk::HList; my $mw = tkinit(); my $hlist = $mw->HList()->pack(); $hlist->bind('',\&do_event); $hlist->bind('',\&do_event); $hlist->bind('',\&do_event); fill_list(); MainLoop; sub fill_list{ for(0..1){ $hlist->add($_,-itemtype => 'text',-text => $_); } } sub do_event{ print $_,"\n" for $hlist->selectionGet(); } sub testsub{ print "@_\n"; }