Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Thanks to everyone that helped me get aroudn the pointer to arrays and hashes of array references and all that mutha jazz. I post my result here. Thsi is my first real foray into arrays and as such I hope is received kindly. Thanks to masem for that lovely snippet just above me. I am going to need a glass fo hogfat to wash that down my mental gullet, so to speak.
#!/usr/bin/perl use SNMP_util; $nameOID = ".1.3.6.1.4.1.2021.2.1.2"; @addOID = qw(.1.3.6.1.4.1.2021.2.1.3 .1.3.6.1.4.1.2021.2.1.4 .1.3.6.1. +4.1.2021.2.1.5 .1.3.6.1.4.1.2021.2.1.101); $IP = "127.0.0.1"; (@tempNameArray) = &snmpwalk($IP,$nameOID); foreach $a (@tempNameArray) { ($throw, $name) = split(/:/,$a,2); push(@arrayNames, $name); } $control = 0; foreach $i (@arrayNames) { foreach $j (@addOID) { (@breakMe) = &snmpwalk($IP,$j); ($throw, $value) = split(/:/,$breakMe[$control +],2); $resultHash{$i} .= $value.","; } $control++; } foreach $key (keys %resultHash) { ($svcMax, $svcMin, $svcActual, $svcErr) = split(/,/,$resultHas +h{$key}); print "-----------------------\n",$key, " values are:\n"; print "Maximum Services: ", $svcMax, "\n"; print "Minimum Services: ", $svcMin, "\n"; print "Actual Services Running: ", $svcActual, "\n"; print "Error Message: ", $svcErr, "\n"; }

In reply to Re: Dynamic array names by CiceroLove
in thread Dynamic array names by CiceroLove

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (2)
As of 2021-09-16 20:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?