Can it be done with CGI-script?

Sure. The first step would be to generate HTML code for links, i.e. instead of print "$f<br />";, you'd write

print "<a href=\"/chat/$f\"> $f </a><br />";

The exact format of the href="..." depends on how your server is configured to access the file, whether you want it served as a static file, or delivered as a dynamic resource (via another CGI script) with a specific MIME type, or with plain text being rendered into HTML, and such...

BTW, directly generating HTML is just the most primitive form there is...  Normally, you'd use some module (like CGI.pm, or one of the many templating modules/frameworks), which would make your life easier — among other things, by taking care of stuff like escaping special characters in file names properly, etc.


In reply to Re^5: Links to web page? by almut
in thread Links to web page? by oh5yw

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.