#!/usr/bin/perl # #Quick script to randomly select a quote from a supplied file. #File shoudl seperate quotes on new lines (\n) # By: David A. Flanigan # No Warrnety provided or implied, use at your own risk. # Free for any use. Please send improvements back to dave@flanigan.net # E-mail dave@flanigan.net with questions on modifying this script. # http://www.flanigan.net/scripts # # Set Quote file here $qfile = "/var/www/html/aclu/quotes.txt"; #Open File for reading open (FILE, "$qfile"); #Split file into an array @quotes = ; #select random element of array #srand; #$relement = rand @quotes; #$qout = $quotes[$relement]; $qout = @quotes[rand @quotes]; # Print Output #print "Content-Type: text/html\n\n"; print "$qout\n";