... # Open the SNMP session and query in the background. $sess = new SNMP::Session(DestHost => $thisip, Community => $$optionsref{community}, Retries => $$optionsref{retries}, Timeout => $$optionsref{timeout}, Version => '1'); $mib = 'sysDescr'; $vb = new SNMP::Varbind([$mib]); # The responses to our queries are stored in %list. $var = $sess->getnext($vb, [ \&gotit, $thisip, \%list ]); # Update the rate limiting counter. $count++; # After every 100 IP's, wait for the timeout period (default is two seconds) to keep from overwhelming routers with ARP queries. if ( $count > '100' ) { &SNMP::MainLoop($looptimer); $count = 0; } # Increment the IP address for the next pass. $intip++; ... # This is the little function called by SNMP::MainLoop when a callback comes in. It just stuffs the value of the response (if any) into the appropriate place in %list and returns. sub gotit { my $myip = shift; my $listref = shift; my $vl = shift; if ( defined $$vl[0] ) { $$listref{$myip}{desc} = $$vl[0]->val; } return(); }