It would have been better to enclose your code snippet in "code" tags. Please read Writeup Formatting Tips. It's not too late to edit your post, deleting all "br" tags, and adding "code" tags around your code.
- what is the "2" in print "$host is dead\n" unless $p->ping($host, 2);?According to the documentation for Net::Ping, the "2" is a timeout value:
Ping the remote host and wait for a response. $host can be either the hostname or the IP number of the remote host. The optional timeout must be greater than 0 seconds and defaults to whatever was specified when the ping object was created.$p->ping($host [, $timeout]);
is there any shortcut way to put this in the @array?I'm not sure what you mean by shortcut, but qw is handy for constructing arrays (note the absence of double quotes and commas):
my @array = qw(4.4.4.4 127.0.0.1 123.333.333.333);
Another general tip: add these to the top of your code:
use warnings; use strict;
I have no answer for your 1st question :(
In reply to Re: Net::Ping issues
by toolic
in thread Net::Ping issues
by chris_henderson
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |