The reason I explained how to slurp the file into a variable was so that it could be 
printed anytime
anywhere.  My solution does not force the file contents to be printed right away.  
This is also
useful for if you wish to replace something in the faq before printing it, or adding 
some to the top
and bottom.  In short, it gives the programmer much more control before simply 
printing the file.

Regards,
David


----- Original Message -----
From: "Todd Wade" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, July 02, 2002 6:19 PM
Subject: Re: Including External Pages


[EMAIL PROTECTED] wrote:

> open(FH, "</usr/www/domain/faq.txt"); # < for read, > for write, >> for
> append local $/ = undef; # slurp mode (allow for shoving the whole file
> into a scalar)
> my $faq = <FH>;  # slurp the whole file into this scalar.
> close(FH);
>

open(FH, $file) or die("open $file: $!");
print(<FILE>);  # print() takes a list. DWIM in action.
close(FH) or die("close $file: $!");

Todd W.

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to