We Recommend

Learning Perl Learning Perl
In this smooth, carefully paced course, a leading Perl trainer teaches you to program in the language that threatens to make C, sed, awk, and the Unix shell obsolete for many tasks. This book is the "official" guide for both formal (classroom) and informal learning. It is fully accessible to the novice programmer.


Posted By

noah on 07/03/07


Tagged

regex file html perl gallery heredoc 2001


Versions (?)


Show JPEGs in this directory all on one page


Published in: Perl 


Dumps a list of image names into an HTML document, wrapped in centered IMG tags. Features the CENTER tag for added historical value.

  1. #! /usr/bin/perl -w
  2. use strict;
  3.  
  4. print "<html><head><title>Generated by Showsm.pl</title></head><body>\n";
  5.  
  6. while (<*\.[(jp)(gif)]*>) { #regex captures any filename with extension beginning "JP"
  7.  
  8. #print "<img src=\"$_\" width=\"800\"><hr>\n"; #an image tag points to each file name
  9. print "<img src=\"$_\" >\n"; #an image tag points to each file name
  10.  
  11. }
  12.  
  13.  
  14. print "</body></html>"

Report this snippet 

You need to login to post a comment.