Take a look at
Tk::DBI::Table. I use this for previewing data from a database and the column names at the top are clickable and can be sorted. I don't know how the author did it, I haven't pulled the code apart but I know he does use a
Tk::Hlist. It may give you some clues.
jdtoronto