#!/usr/bin/perl -w use strict; use CGI::Carp qw(fatalsToBrowser); # ---------------------------------------------------------------------- my $default_file = 'bigmouthfullsgals.txt'; # # $default_file is the path (either absolute or relative) to the file # you want to use when you didn't ask for an explicit file as part # of the URL. # # ---------------------------------------------------------------------- my $filename = $ENV{'PATH_TRANSLATED'} || $default_file || 'urls.txt'; $filename =~ s/[^\w\/\-\.]/_/g; # lingering paranoia my @choices; if ( -f $filename and -r $filename ) { open( FILE, "<$filename" ) or confess( qq|opening file: "$filename", $!| ); while( ) { next if m/^#/; next if m/^\s*$/; chomp; push( @choices, $_ ); } } srand( time ); print qq|Location: $choices[int(rand(scalar(@choices)))]\n\n|; exit; # ---------------------------------------------------------------------- # this program contains more comments than code