#!/usr/local/bin/perl5 -w #script that takes files in the images directory and places each #one in a web page. captions added later by hand sub comment_out { #open directory opendir(MAIN, "/raid0/usr/people/whistle/www/archive/photos/images") || die "no such directory:$!"; #read from it @name = readdir(MAIN); close(MAIN); #loop through the array containing all the file names # foreach $name(@name) { # $namecopy = $name; # if($name =~ m/(gif|jpg)/) { } #open the template file for reading open(IN,"photcaptiontemp"); #open a newfile for writing based on a template #create a name for new file. Same as old name but .htm extension $namecopy =~ s/\.[a-zA-Z]*/\.htm/; open(OUT,">el62412.htm"); #write new file, making necessary replacements while() { $line = $_; if($line =~ m/replace/) { $line =~ s/replace/el62412.jpg/; print OUT "$line\n"; } else { print OUT "$line\n"; } #end if else } #end while sub comment_outout { # } #end if jpg or gif loop #} } #end foreach loop which goes through all the file names #in the array containing the list of files in the directory