#!/usr/bin/perl -w $| = 1; # turn off output buffering sub picBlock { my $filename = $_[0]; return if ! defined($filename); my $rootname = $filename; $rootname =~ s/_small.jpg$/.jpg/; # delete _small for name my $alt = $rootname; $alt =~ s/.jpg$//; # delete .jpg suffix $alt =~ s/_/ /g; # convert underscores to spaces $alt =~ s/\+/ \& /g; # convert + to andphersands with spaces print "\n"; print "\n"; print "
$alt\n"; } my @files = `ls *small.jpg`; chomp @files; # remove all the trailing newlines my $numRows = 0; print "
"; print ""; while (@files) { print ""; if ($numRows & 1) { print ""; if (!($numRows & 1)) { print ""; if (!($numRows & 1)) { print "\n"; $numRows++; shift @files; shift @files; shift @files; } print "
\n"; } else { print "\n"; }; picBlock($files[0]); print "\n"; } else { print "\n"; }; picBlock($files[1]); print "\n"; } else { print "\n"; }; picBlock($files[2]); print "
\n"; print "
\n";