#!/usr/bin/perl -w ### script began to index image files in a directory ## PBM use strict; use Cwd; open(OUT, ">index.html") or die "Can't open index file: $!\n"; &printhead(); &processfiles(); &printtail(); sub printhead{ my $curr = cwd(); print OUT "\n\n"; print OUT " Listing of files in the directory \n"; print OUT "\n\n"; print OUT "

Directory Index

\n"; print OUT "

"; } sub processfiles { opendir(CURRDIR, '.') or die "Cant open direcotry ($!), exiting.\n"; my $file = ""; while (defined($file = readdir(CURRDIR))) { if (-f $file ) { ##begin my hodgepodge to add descriptions print "please enter a description of the file '$file'\n"; my $desc =; chomp $desc; print OUT "$file --> $desc
\n"; } } ##end my hodgepodge closedir(CURRDIR) } sub printtail { print OUT "\n"; close (OUT); }