#!/usr/bin/perl -wT
use CGI qw(:standard);
use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
use strict;

my(@urllist) = ();
my(@namelist) = ();
open(IN, "urldata.txt") or exit;
while (my $line = <IN>) {
   chomp($line);
   my($url, $name) = split(/\|/, $line);
   push(@urllist, $url);
   push(@namelist, $name);
}
close(IN);

print header;
my $index = int(rand(@urllist));
print qq(<a href="$urllist[$index]">$namelist[$index]</a>);