#! /usr/bin/perl use CGI qw/:standard/; print header, start_html("Pictures"); die("could not open $dirname") unless (open(LS, "ls |")); @lsout = ; foreach $name (@lsout) { chomp($name); if ( "$name" =~ /\.JPG/ || "$name" =~ /\.jpg/) { print "", img {src=>"Small/$name"} , "\n"; } } print end_html;