> 
> I am using snmp to walk a couple of tables on some switches to output
a list
> of mac to port numbers. It works fine when using only 1 switch, when I put
> multiple switches in the list to walk, the output gets messed up showing
> multiple ports and or the same port but with different hosts. I have tried
> to put in "sleep" statements thinking maybe some data was lingering in but
> that did not help. I also tried replacing the "foreach" with a "while -
> foreach" on line 7 but then is skips the first switch and only walks the
> second switch. Any thoughts?  Unfortuantely I can't uprgrade my
switches so
> they will accept SNMP v2 so I am stuck with walking instead of a
bulkget. My
> file is structured like this:
>  
> file: switches
> x.x.x.x,-c <community
string>,1.3.6.1.2.1.17.4.3.1.1,1.3.6.1.2.1.17.4.3.1.2
> x.x.x.x,-c <community
string>,1.3.6.1.2.1.17.4.3.1.1,1.3.6.1.2.1.17.4.3.1.2
>  

[snip code]

I will admit I didn't take a long look at your code, I suspect the
problem is as you state lingering values in variables.  

I would suggest scoping your variables properly, turning on strictures with:

use strict;

Naming your variables with something useful rather than $a, $b, S, T,
etc. Dropping ampersands on function calls when they are not needed.
Using explicit variables rather than $_.

Cleaning up these things will make your code readable, will improve your
ability to debug it, etc.  Having completed those tasks if you are still
stumped then check back... maybe some other brave soul will take up the
task without these things....

http://danconia.org


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to