#!/usr/bin/perl -wT use CGI qw(:standard); use CGI::Carp qw(warningsToBrowser fatalsToBrowser); use strict; my ( $dir, #path to directory $dir_file, #sample file in the directory @files, #array of all the files in the directory @lines #array of all the lines in the sample file ); $dir = "/home/hopefulc/public_html/cgi-bin/"; $dir_file = "/home/hopefulc/public_html/cgi-bin/koh_members_list.cgi"; opendir(DIR, $dir) || die("Failed To Open Directory"); @files = readdir(DIR); close(DIR); print header; print start_html("Test CGI"); print "

The files in the directory are listed below:

\n

\n"; foreach my $file (@files) { print "$file\n
\n"; } print "

The lines in the file are listed below:

\n

\n"; open (FILE, $dir_file) || die("Failed To Open File"); @lines = ; close(FILE); foreach my $line (@lines) { print "$line\n
\n"; } print end_html;