Well, my coding style isn't the bible. I would say it doesn't differ much from the average one of most perl programmers with some experience, but I'm sure some people would disagree. For example I like very much to use short-circuiting logical operators for flow control. And at times I tend to overuse
$_. If it were me chances are that the main loop may have looked like this:
for my $net (@net) {
for (16..250) {
local $_="$net.$_";
warn "$_ not responding!\n" and next
if !$p->ping($_);
print;
}
}
And while it's very clear and immediate to me I understand that others' opinion may vary, and expressive variable name like
$host may be preferable for maintainability resons.
Also, if the script were only just a bunch of lines longer, I would have never used the -l switch. Of course I'm eagerly waiting for (Perl6's) say().
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.