$mib = 'someMibObject'; $vb = new SNMP::Varbind([$mib]); # Note the duplicate getnext()'s... LOOP: for ( $var = $sess->getnext($vb) ; ($vb->tag eq $mib) and (not $sess->{ErrorNum}) ; $var = $sess->getnext($vb) ) { # If we get here, we use $vb->iid or $var or both to do # something useful with the response. } if ( $sess->{ErrorNum} ) { # There was an error. Print $sess->{ErrorStr} and/or # croak() or whatever. }