Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

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

by TedPride (Priest)
on Sep 02, 2006 at 22:30 UTC ( #570894=note: print w/ replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://570894]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (17)
As of 2015-07-28 18:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (258 votes), past polls