#!/usr/bin/perl -w use strict; use CGI qw/:standard/; print header; print start_html({-title=>'Image Lister', -bgcolor=>"#cccccc"}); my $me = CGI::url(); if (param('pic')) { my $pic = param('pic'); $pic =~ s/^\.+//; if ( -e "./$pic" ) { print img({src=>$pic, border=>1}), br, hr; } else { print "invalid pic."; } } opendir CURRENT, "." or die "What the? ($!)"; my @images = grep { /(png|jpg|gif)$/ } readdir CURRENT; close CURRENT; print br, a({-href=>"$me?pic=$_"}, $_) foreach @images; print end_html;