in reply to Re: Net::Ping and STDOUT
in thread Net::Ping and STDOUT

Your hint about $| was right on the nose, thanks. I'll try to rewrite it with your stylistic input, thanks for that too. I thought that there had to be cleaner way to do the loop, but I'm not familiar with the idioms of perl.

Replies are listed 'Best First'.
Re^3: Net::Ping and STDOUT
by blazar (Canon) on Aug 04, 2005 at 17:45 UTC
    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().