in reply to Net::Ping:External

What operating system are you running this code on? The module says it is still in alpha stage on CPAN, and for Windows systems, it was only tested on 98. I ran the following on Windows 2000, using ActiveState 5.6.1 build 632:
#!C:\perl\bin\perl use strict; use warnings; use Net::Ping::External qw(ping); print ping(host=>"yahoo.com"), " | ", ping(host=>"wayfakehostname.com" +);
And received the following output:
C:\Documents and Settings\marc>perl test.pl 0 | 0
On my system ping() is returning 0 for both valid and invalid hostnames (unless it didn't correctly perform the ping, I haven't checked the internals yet), which is why nothing is printing out when I run your code, either. Try playing around with the module a bit more, perhaps your output is similar (and/or perhaps you're using ActivePerl and their port is broken).

Update: There *is* a small bug in the _ping_win32() function of Net::Ping::External (at least the version available through PPM for ActiveState). I changed the last two lines of my own copy from this:
return 1 if $result =~ /time?\d*ms/; return 0;
to this:
return $result =~ /time=\d+ms/?1:0;
and now it works fine for me. I should probably email the author with that bugfix, perhaps it only is affected in 2k, but I suspect not, the time? will positively match, then because he's missing the '=', the rest fails. I can't imagine that 98's ping prints 'time49ms'.

oh, and modifying it using fglock's and zigdon's comments, it works like you want it to :)