in reply to Printing contents of file on a HTML page.

You might be interested in using Template Toolkit for this. First of all, you can forego the process of reading the file, and simply insert it into the template. Consider the following code:

#! /usr/bin/perl use strict ; use warnings ; $|++ ; use Template ; my $tmpl = <<'END_OF_TEMPLATE' ; Content-type: text/html <html> <head> <title>Title</title> </head> <body> <p>Okay this prints out.</p> [% INSERT $myfile %] </body> </html> END_OF_TEMPLATE my $tt = new Template { 'ABSOLUTE' => 1 } ; my $filename = '/home/doug/.bashrc' ; $tt->process( \$tmpl, { 'myfile' => $filename } ) or die $tt->error() +; exit ;

This should do what you want, while at the same time giving you some added flexibility on how you deal with the file contents. For example, if you want to escape all the HTML tags in the included file, you'd say [% INSERT $myfile | html %]. If you wanted to take a text file that was broken up into paragraphs and retain that formatting, you'd say [% INSERT $myfile | html_para %]. If you wanted to preserve the line breaks in the input file without using <pre>..</pre> tags, try [% INSERT $myfile | format( "%s<br />" ) %]. Read the docs for more info.

HTH


_______________
DamnDirtyApe
Those who know that they are profound strive for clarity. Those who
would like to seem profound to the crowd strive for obscurity.
            --Friedrich Nietzsche