"Gary Stainburn" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Thursday 02 Oct 2003 10:25 am, Owen wrote: > > On Wed, 01 Oct 2003 23:14:00 -0700 > > > > Bryan Harris <[EMAIL PROTECTED]> wrote: > > > What I'm interested in is what's the easiest way to print the contents of > > > a file? For example, if I want to output my header file, "header.incl", > > > how can I print the contents of that file the easiest (and most generally > > > compatible)? > > <snip /> > > > > You may wish to change the print line to print "$_<br>\n"; if you want > > a new line on your html for each new line in your file. > > > > > > > > Owen > > Hi Owen, > > One thing you forgot was to close the file. Also, don't forget that you can > do it with less typing: > > $file = "/location/of/header.incl"; > open (FH, "$file") or die "Cannot open file $file $!"; > print while(<FH>); > close(FH); > --
or simply: print <FH>; print takes a list of arguments: [EMAIL PROTECTED] trwww]$ perl use warnings; use strict; print <DATA>; __DATA__ one two three Ctrl-D one two three Todd W. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]