#! /usr/bin/perl -w ########################################################################### # Author: Joe Klemmer # Date: January 22nd, 1998 # License: Public Domain # # This script is 100% free and can be used and abused by anyone for # anything they want. # # Description: This is a very "down-n-dirty" script for doing random # banner stuff for David. Maybe someday I'll actually make it elegant. # This can be used as a Server Side Include (SSI) script for your web # server. # # Usage: 'banner.pl ' # # where is a text file with the links to the images in # it one line at a time. # ########################################################################### # Get the lines from the file using 'cat'. If the file gets to big or # major performance problems occur then this will need to be changed # to a file read routine. # @f = `cat @ARGV`; # Setup and loop through the list from above getting a count of the lines. # There's definitely a better way to do this but it's nearly midnight so... # $i = 0; while($f[$i]) { chomp $f[$i]; $i++; } # Do this just because! Seriously, it's needed due to the fact that $i # will end up with one more than the actual lines after the while loop. # $i--; # Get a random number between 1 and $i # $pick = rand($i) + 1; # Print this line of the file out to stdout. Should just spit it into the # web page wherever the SSI is setup to run. # print $f[$pick]."\n"; # End program. # exit;