Thanks, Curtis! Below is the script. (I hope it's clear!)
____________________________________________________
#!/usr/local/bin/perl
#This script will be called using the "POST" method,
#contained in a HREF that the
#site visitor clicked on.
#The call will contain an argument, which will
#be the name of the directory for the
#script to read using READDIR.
use strict;
use CGI qw/:standard/;
my $dir = param('dir');
#Verify that the requested directory exists.
#I imagine I want to say something like:
if (-d $dir) {
#Anyway, if the directory represented by
# $dir does exist,
# I start a table on the HTML page...
print <<END;
Content-Type: text/html\n\n
<html>
<body>
<table>
END
#...then I build an array of all files that are GIF or JPEG...
#(I think this would get me all the files in the directory $dir.)
#(By the way, do I need "my" in front of this declaration?)
@filearray = opendir(D,$dir) or die $!;
#From the complete listing in @filearray,
#build a new array, which contains only
#files of HIF and JPG types...
@imagefiles = grep/\.(gif|jpg)$/,readdir(D);
closedir D;
#With @imagefiles successfully defined, I want to loop through the slots
#in @imagefiles, using each entry as the IMG SRC in a new table row...
for ($i = 0; $i <= $#imagefiles; $i++) {
print <<END;
<tr>
<td>
<img src=$i>
</td>
</tr>
END
last;
}
#With the loop finished, the script finishes writing the HTML page.
print <<END;
</table>
</body>
</html>
END
#Fail (somewhat) gracefully...
} else {
print <<END;
Content-Type: text/html\n\n
<html>
<body>
<H3>"The directory could not be found."
</body>
</html>
END
}
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]