Simple Perl Example
Flexible Web Page Generation

Example #3:   Random Image Program

This perl program grabs the names of some graphic images that are stored in another directory. It puts the names into an array, and then randomly selects one of those images. It then generates a web page with the random graphic. This program links to the other example, gallery.pl.

View the Source Code:


Example #4:   Form Gallery Program

This program demonstrates some of the power of perl in generating dynamic web pages. It reads the header part of the HTML document from a file. An advantage here is that if a series of web pages all have the same format, this information can be maintained in one file that when updated, will be applied to all pages.

This program also uses the same technique to grab the list of file names from another directory, but this time it generates a full ordered list of entries on the web page using a looping variable. This program links back to Example #3.

View the Source Code:



Click here to run the programs and see the output: