Kill the "open" and "close" lines and change the print to:#!/usr/local/bin/perl @machines = qw( host1.foo.com host2.foo.com host3.foo.com ); $HTML = "\n"; $HTML .= " \n"; $HTML .= " \n"; foreach $machine (@machines) { $response = `ping $machine`; $HTML .= "$machine: $response"; } $HTML .= " \n"; $HTML .= " \n"; $HTML .= "\n"; open(HTMLFILE, ">pingresults.html") || die "Couldn't open pingresults\ +n"; print HTMLFILE "$HTML\n"; close (HTMLFILE);
There are better ways to do these kinds of things, so do some reading and searching around here and you will learn some things for the long run. Also, learn the first two rules of good Perl: use the "-w" flag on the #!/usr/local/bin/perl -w line and learn/read about "use strict". Life will be much less painful in the long run.print "$HTML\n";
In reply to Re: How do I print output to STDOUT instead of to an HTML file?
by THRAK
in thread How do I print output to STDOUT instead of to an HTML file?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |