Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/local/bin/perl
@machines = qw(
host1.foo.com
host2.foo.com
host3.foo.com
);
$HTML = "<html>\n";
$HTML .= " <body>\n";
$HTML .= " \n";
foreach $machine (@machines) {
$response = `ping $machine`;
$HTML .= "$machine: $response";
}
$HTML .= " \n";
$HTML .= " </body>\n";
$HTML .= "</html>\n";
open(HTMLFILE, ">pingresults.html") || die "Couldn't open pingresults\n";
print HTMLFILE "$HTML\n";
close (HTMLFILE);
How can I get the output to print to STDOUT rather than an HTML file?
I know this seems kind of pointless, but I eventually want to be able to pipe the output to an external program for monitoring purposes.
I'm new to perl (did you guess?), so thanks in advance for your patience.
rgds,
protos
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How do I print output to STDOUT instead of to an HTML file?
by little (Curate) on Apr 18, 2001 at 21:43 UTC | |
by Sherlock (Deacon) on Apr 18, 2001 at 21:52 UTC | |
by ChemBoy (Priest) on Apr 18, 2001 at 22:27 UTC | |
by Sherlock (Deacon) on Apr 19, 2001 at 00:20 UTC | |
|
Re: How do I print output to STDOUT instead of to an HTML file?
by protos (Initiate) on Apr 18, 2001 at 22:35 UTC | |
|
Re: How do I print output to STDOUT instead of to an HTML file?
by tinman (Curate) on Apr 18, 2001 at 21:47 UTC | |
|
Re: How do I print output to STDOUT instead of to an HTML file?
by iguane (Beadle) on Apr 18, 2001 at 22:04 UTC | |
|
Re: How do I print output to STDOUT instead of to an HTML file?
by THRAK (Monk) on Apr 18, 2001 at 21:53 UTC |