)
{
# Skip comment line.
if ($line =~ /^#/) { next LINE; }
# Skip blank line.
if ($line =~ /^\s+/) { next LINE; }
# Remove trailing newline.
chomp($line);
# If we have neither a description or a URL, assume this line
# is a description.
if ((!$gotdesc) && (!$goturl))
{
$desc[$numentries] = $line;
$gotdesc = 1;
next LINE;
}
# If we have a description but no URL, assume this line is a URL.
if (($gotdesc) && (!$goturl))
{
$url[$numentries] = $line;
$goturl = 1;
$numentries++;
next LINE;
}
# If we have both a desc and URL, assume line is a desc for next entry.
if (($gotdesc) && ($goturl))
{
$desc[$numentries] = $line;
$gotdesc = 1;
$goturl = 0;
next LINE;
}
}
# Randomly choose one entry.
srand;
$whichone = int(rand($numentries));
# Print out the desc and URL in HTML.
print "$desc[$whichone]\n";
print "$LINKSTR\n";
# Close file.
close(DIDUNO);
exit;