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


in reply to batch ping problem

How about using Net::Ping to do the checking?

As for the 'styllistic' part:
1. small tools like this should not be interactive -- if they get all the needed data from command line (@ARGV) they are easier to reuse in bigger scripts.
2. The /^64 bytes from ([0-9.]):/ will never match -- should be /^64 bytes from ([0-9.])*:/. Even then, finding such a line will mean that host $1 is available.
3. You're making the task more complex than it really is -- why dump all that data in one log file and then try to make sense of it if you could analyze it immediately after running ping?
4. Easier way of getting ping's output: my $t = `ping...`;

Update: See the example on `man Net::Ping` -- it does exactly what you need, you just have to fill in the address array. -mk