#!/usr/local/bin/perl # # textrotate.pl # version 961121 # copyright 1996 by bo larsson # all rights reserved # # this CGI program returns one link from the specified file. It then places # this link at the very end of the file. Make sure $the_file is world-writeable. # # bugs or feedback to bliss@seagull.net # for information on how to use, visit http://www.seagull.net/bliss/ $the_file = "./fortunes.txt"; $item = "0"; open(THE_FILE,"$the_file"); while () { $array[$item++] = $_; } close(THE_FILE); $link = ""; open(THE_FILE,">$the_file"); flock(THE_FILE,2); foreach $one (@array) { if ($link eq "") { $link = $one; } else { print THE_FILE "$one"; } } print THE_FILE "$link"; flock(THE_FILE,8); close(THE_FILE); print "Content-type: text/plain\n\n"; print "$link\n";