Perl Quiz-of-the-Week #14

Mark Jason Dominus <[email protected]> Wed, 11 Jun 2003 23:14:53 -0400
Newsgroups gmane.comp.lang.perl.qotw.quiz-of-the-week
Organization Plover Systems
Message-ID <[email protected]>
IMPORTANT: Please do not post solutions, hints, or other spoilers
        until at least 60 hours after the date of this message.
        Thanks.

IMPORTANTE: Por favor, no enviéis soluciones, pistas, o cualquier otra
        cosa que pueda echar a perder la resolución del problema hasta
        que hayan pasado por lo menos 60 horas desde el envío de este
        mensaje. Gracias.

IMPORTANT: S'il vous plaît, attendez au minimum 60 heures après la
        date de ce message avant de poster solutions, indices ou autres
        révélations. Merci.

WICHTIG: Bitte schicken Sie keine Lösungen, Tipps oder Hinweise für
        diese Aufgabe vor Ablauf von 60 Stunden nach dem Datum dieser
        Mail. Danke.

BELANGRIJK: Stuur aub geen oplossingen, hints of andere tips in de
        eerste 60 uur na het verzendingstijdstip van dit
        bericht. Waarvoor dank.

VNIMANIE: Pozhalujsta ne shlite reshenija, nameki na reshenija, i
        voobshe lyubye podskazki v techenie po krajnej mere 60 chasov
        ot daty etogo soobshenija.  Spasibo.

Qing3 Zhu4Yi4: Qing3 Ning2 Deng3Dao4 Jie1Dao4 Ben3 Xin4Xi2 Zhi1Hou4 60
        Xiao3Shi2, Zai4 Fa1Biao3 Jie3Da2, Ti2Shi4, Huo4 Qi2Ta1 Hui4
        Xie4Lou4 Da2An4 De5 Jian4Yi4.  Xie4Xie4.


Write a program which generates an HTML table of contents for a
directory of files.  It should read the directory, producing a list of
the files, and write out a file "toc.html" in that same directory, in
the following format:

        <title>Table of Contents for [Directory Name]</title>

        <h1>Table of Contents for [Directory Name]</h1>
        <a href="file1">file1</a><br>
        <a href="file2">file2</a><br>
        ...
        <a href="lastfile">lastfile</a><br>

The files should be listed in alphabetic order.  The program should
accept a command-line argument that tells it what directory to index;
if the argument is omitted, it should index the current directory.

The expert quiz may come out tomorrow, or maybe not at all, depending
on how things go; I'm still in Hawai`i.