I downloaded a script off the net that will display a random link taken from a text file. Here is what it currently shows:
I have changed the script to my liking, so it only displays the title and url. The script works great, however it still is not up to my liking. I am wondering if it is possible to display 5 different links taken from the same data file. These links should be different from all the other displayed. Is this possible?
I was thinking maybe srand could choose a line to display, then it could add one number and display the next line, and add another number and another line. Is that possible?
I am completely clueless with this.
Code:
open (QUOTEFILE, "<$data_location/$file") || die print "Could not open ad links file";
@line=<QUOTEFILE>;
close (QUOTEFILE);
srand;
$array = $line[int rand(@line)];
@adlink = split (/\|/, $array);
print "$adlink[0] " if ($adlink[0]);
print "<A HREF=\"$adlink[2]\"";
print " TARGET=\"$adlink[3]\"" if ($adlink[3]);
print ">$adlink[1]</A>";
print " $adlink[4]" if ($adlink[4]);
exit;
I have changed the script to my liking, so it only displays the title and url. The script works great, however it still is not up to my liking. I am wondering if it is possible to display 5 different links taken from the same data file. These links should be different from all the other displayed. Is this possible?
I was thinking maybe srand could choose a line to display, then it could add one number and display the next line, and add another number and another line. Is that possible?
I am completely clueless with this.