Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
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?
[atcroft]: .oO(Then there is the effect if a site changes their timezone, such as when the International Date Line was moved by the purchase of Alaska by the US from Russia in 1867, or several places (I cannot recall off-hand) that moved from one side of the Date
[atcroft]: Line to the other recently....)
[atcroft]: .oO(Then again, you also have to be careful if you had it to the database, and be aware of any assumptions it makes (such as SQLite assuming Gregorian calendar and a day of exactly 86400 seconds)...)

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2017-04-29 04:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (531 votes). Check out past polls.