http://www.perlmonks.org?node_id=1080581


in reply to Using Ping with perl

Here are the basics of Net::Ping (Pieces extracted from old code):
# Assumes $host is set to what you want to ping my $p = Net::Ping->new("icmp",$TimeOut,,,$ttl); $p->hires(1);#use Time::HiRes module, allowing milliseconds to be +returned by subsequent calls to ping(). my ($ret, $duration, $ip) = $p->ping($host); if ($ret){ $verbose and printf("$host [ip: $ip] is alive (%.2f ms)\n" +, 1000 * $duration); } $p->close();

        What is the sound of Perl? Is it not the sound of a wall that people have stopped banging their heads against?
              -Larry Wall, 1992

Replies are listed 'Best First'.
Re^2: Using Ping with perl
by thargas (Deacon) on Apr 03, 2014 at 11:01 UTC
    If you want to simulate traceroute, have you tried looking how it's done in Net::Traceroute::PurePerl. Unfortunately, it's not as straightforward as your code hopes.