Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Why does Net::Ping behave this way?

by brianarn (Chaplain)
on Apr 03, 2002 at 14:37 UTC ( [id://156402]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Why does Net::Ping behave this way?

Fletch gave an excellent response, so I'll leave it at that.

However, in the interest of promoting Good Coding Practices ©, I'd make a few subtle comments about the code.
  • Personally, I like using Getopt::Long versus Getopt::Std, as it allows for more verbose options and short ones together.
  • Look into Pod::Usage, which is part of the core set of modules. It comes with a pod2usage function that allows you to write POD at the end of your file, and then present it at various levels of verbosity, including an error message if you desire. For such a short script, it might be a bit of overkill, but in a lot of cases, short scripts tend to grow up, and putting in a good solid foundation really allows for one's code to grow nicely, rather than being deliquent hackery.
  • Your for loop will iterate from 0 to 254, not 0 to 255. The conditional is that current is less than end, and end is 255, so technically it'll never do the 255th IP.
=)

~Brian

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://156402]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.