http://qs321.pair.com?node_id=570894


in reply to generating a large list of names to be displayed neatly in HTML

A raw list in alphabetic order is probably fine. They can use the find function on their browser to locate things from there. However, if you -really- want a list that you can jump around in by letter:
use strict; use warnings; my (@names, $f, %names); chomp (@names = <DATA>); for (@names) { $f = substr($_, 0, 1); push @{$names{$f}}, $_; } print join ', ', map { "<a href=\"#$_\">$_</a>" } sort keys %names; print "<p>\n\n"; for (sort keys %names) { print "<a name=\"$_\"></a><b>$_</b>\n<ul>"; print join "\n", map { "<li>$_" } sort @{$names{$_}}; print "</ul><p>\n\n"; } __DATA__ Alvin Clarissa Kappa Bob Bubba Zim
There's probably a CSS way to make it so just pressing a key on the keyboard jumps to that letter, but I'm not going to complicate things.
  • Comment on Re: generating a large list of names to be displayed neatly in HTML
  • Download Code