Hans van Leeuwen wrote:
Hello,
Hello,
I use the script below to print all sorts of system information from my
server and mail it to me. Because these emails get rather large, I
created an HTML index for easy navigation.
This all works fine, but printing the output to a file and then
displaying it again does not seem the best way to do this.
Is there any way I can print the output from "OPEN" to a variable
instead of a file?
perldoc -f open
[snip]
File handles can be opened to "in memory" files held in Perl
scalars via:
open($fh, '>', \$variable) || ..
Though if you try to re-open "STDOUT" or "STDERR" as an "in
memory" file, you have to close it first:
close STDOUT;
open STDOUT, '>', \$variable or die "Can't open STDOUT: $!";
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>