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?

Thanks.


Hans



#!/usr/bin/perl

sub head {

push(@head, "@_");
print "\n<a name='" . "@_" .
"'><table><tr><td><b>@_</b></tr></td></table>\n\n";

}

$| = 1;
open(STDSAVE, ">&STDOUT");
open(STDOUT,">/tmp/tmp.log");


head("Users");
system("/usr/bin/w -h");

head("Disks");
system("/bin/df -h");

# etc...

close(STDOUT);
open(STDOUT,">&STDSAVE");

print "<ol>\n";
foreach $header(@head)
{
   print "  <li><a href='#" . $header . "'>$header</a></li>\n" ;
}
print "</ol>\n";


system("cat /tmp/tmp.log");
















-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to