Dirk2 Dirk at
Sat May 22 08:39:40 CDT 2004

Perl Mongers,

Why can't we ping from inside a Perl script?  Anything obvious I'm 
missing here?

~: uname -a
Linux localhost.localdomain 2.4.21-15.EL #1 Thu Apr 22 00:26:34 EDT 2004
i686 athlon i386 GNU/Linux

That's Red Hat Enterprise Linux ES (v. 3 for x86)

Here's the script that fails:
#!/usr/bin/perl -w

use Net::Ping;

if ( pingecho("", 2) ) {
    print "Yahoo is on the network.\n";

But ping on the command line works fine:

~: ping
PING ( 56(84) bytes of data.
64 bytes from ( icmp_seq=0 ttl=49
time=22.1 ms
--- ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 22.109/22.109/22.109/0.000 ms, pipe 2


The posting address is: san-diego-pm-list at

List requests should be sent to: majordomo at

If you ever want to remove yourself from this mailing list,
you can send mail to <majordomo at> with the following
command in the body of your email message:

    unsubscribe san-diego-pm-list

If you ever need to get in contact with the owner of the list,
(if you have trouble unsubscribing, or have questions about the
list itself) send email to <owner-san-diego-pm-list at> .
This is the general rule for most mailing lists when you need
to contact a human.

More information about the San-Diego-pm mailing list