Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: batch ping problem

by marcink (Monk)
on Jun 13, 2001 at 19:18 UTC ( [id://88085]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://88085]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2025-06-24 01:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.