Name

ping

Synopsis

$p->ping(host[, timeout])

Pings remote host and waits for a response. Takes the following arguments:

host

Specified as either the hostname or the IP number of the remote host.

timeout

Optional, must be greater than 0 seconds if specified. Defaults to whatever was specified when the ping object was created.

If host cannot be found, or if there is a problem with the IP number, returns undef. Otherwise, returns 1 if the host is reachable and 0 if it is not.

Get Perl in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.