opendir BUFFER, "images/" or "Serious Headache! $!"; my @templist = readdir BUFFER; closedir(BUFFER); #Print the table of pictures.... jpg's and then gif's............................. my @results; my $count = 0; print "\n\n"; foreach(@templist) { if($_ eq "." || $_ eq "..") { #Do Nothing. } else { if(substr($_, length($_)-4, length($_)) eq ".jpg") { print "\n"; $count++; } else { if(substr($_, length($_)-4, length($_)) eq ".gif") { print "\n"; $count++; } } # Write the end of line... if($count == 4) { print "\n"; $count=0; } } } print "
\"Loading...jpg\"
"; print substr($_, 0, length($_)-4) . "
Loading...gif
\n"; print substr($_, 0, length($_)-4) . "
\n";