in reply to storing result in variable

Net::Ping might work better than a system call.. Some recent threads related to Net::Ping: Net::Ping and STDOUT, net ping question, Net::Ping with threads

as for your code, why are you fork'ing? Is system (exec never returns -- system does) more what you're looking for? Or even just backticks (see perlop)?
open PING, ">>dummy"; print PING `ping $host`; close PING;

Replies are listed 'Best First'.
Re^2: storing result in variable
by slayven (Pilgrim) on Nov 03, 2005 at 20:18 UTC

    You may be right about Net::Ping to work better than a system call. But it slightly differs from the ping-program. The default protocol for Net::Ping is tcp where ping uses icmp. The tcp-connection requires a running echo-service on the remote machine whereas the icmp-connection (usually) requires the icmp-packages not to be explicitly dropped.

    With Net::Ping you can specify icmp as the connection method but this requires root permissions.

    --
    trust in bash
    but tie your camel