#!/usr/local/bin/perl # Program name: gallery.pl # Author: D. W. Hyatt # This program opens a file containing some header information and uses # that text in the HTML document that this perl page generates. # As in the previous "random.pl" example, it gets a list of all the # graphic images in another directory, but it creates an ordered # list of hypertext references to those graphics. $fname = "header.txt"; # Assign file name open (FPTR, $fname); # Open file containing HTML header @headertext = ; # Read the file into an array srand; # initialize random seed $i=0; while (<../images/*>) { # loop through directory and get names of images $imagearray[$i++] = $_; # The "$_" is a default scalar input variable } $last = $#imagearray; # This is a special way to find the highest index print "Content-type: text/html\n\n"; print< Photo Image Gallery

URL List:

    EOF # Print URLs as List Elements for ($i=0; $i<=$last; $i++) {print "
  1. $imagearray[$i] \n";} # Print rest of document print<

    Back to Random Page

    EOF