Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

creating hyperlinked lists

creating hyperlinked lists

creating hyperlinked lists

I am trying to write a program in perl that will read my
data from a text file, parse it, and then format it out
on my webpage as hyperlinks and in alphabetical order.
However, all the books that I have, not one tells me how
to turn the text in the text file into a hyperlink and
sort it alphabetically.  Please help!

RE: creating hyperlinked lists

If your text file is pipe delimited.... looks like.......

URL | URL-label
http://www.someServer.com/|Link to Some Server
http://anotherServer.com|Link to another server

and is named URLs.txt


#!/usr/local/bin/perl -w
# print normal html stuff to get page going
print "Content-Type: text/html\n\n";
print '<HTML><HEAD><TITLE>title here</TITLE></HEAD><BODY><P>';

# read the input file
open(IPF,"<URLs.txt") or die;
while ($line = <IPF>)
  chop ($line);
  @fields = split(/\|/,$line);
  print '<a href="'."$fields[0]".'">'."$fields[1]".'</a><BR>';  
close IPF;
print '</P></BODY></HTML>';

I typed this here and have not run it.....might have a minor typo....;^)    but you get the ideas I hope.

'good luck

keep the rudder amid ship and beware the odd typo

RE: creating hyperlinked lists

That helped more than one person, goBoating. Thanks for that.


vic cherubini
epic software
Knows: Perl, HTML, JavScript, C/C++, PHP, Flash, Director
Wants to Know: Java, Cold Fusion, Tcl/TK

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close