use strict; use CGI; use CGI::Carp( 'fatalsToBrowser' ); use HTML::Entities; my $q = CGI->new(); my $dir = '\images'; # or some other default. chdir( $dir ) or die "Couldn't cd to '$dir', $!"; my @images = map {glob( "*.$_" )} qw( gif jpg jpeg tif xif bmp ); @images = map { encode_entities( $_ ) } @images; print $q->header(), $q->start_html(); print $q->h1( "My Image files" ); print "\n\n"; print $q->end_html();