in reply to reading all images in a directory

$count = 0; while(my $file = readdir(DIR)) { print "$file "; # can change \n to </tr><tr> here. remember # to surround the while with <tr> and </tr> print "\n" unless (++$count % 5); }
surrender to perl. your code, your rules.