Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re: (Getopt, $_, nonport interfaces)

by ybiC (Prior)
on Jul 24, 2001 at 06:01 UTC ( #99212=note: print w/replies, xml ) Need Help??

in reply to

    Hi fingers,
First off - good job for using Net::Snmp!   I used UCD SNMP for a similar script because of the included additional utilities, but in hindsight wish I'd done like you.

A couple of trivial suggestions come to mind:

  • Getopt::Long might simplify processing of command-line arguments.
  • If you're going to use $hostname instead of $_ in
    foreach(@hostname){ undef @unique; $hostname=$_;
    it could be a tiny bit cleaner as
    foreach $hostname(@hostname){ undef @unique;
  • I don't know how well the particular syntax would transfer to your code, but "(code) mind your snmPs & Qs" uses a hash to count non-port interfaces, then subtracts them from final port status report.   As you note, it reaaally improves accuracy of generated reports.
BTW, thanks for the compliment in your pod.   I "appreciate poorly written code" because I'm so well practiced at *writing* it! 8^D
    striving toward Perl Adept
    (it's pronounced "why-bick")

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://99212]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (9)
As of 2017-07-26 15:33 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (398 votes). Check out past polls.