Thanks and ++ to danger and chipmunk for pointing out my blind spot: second $ in $mib{$key}   Working code snippet below (tweaked a bit more).
    cheers,
    Don
    striving toward Perl Adept
    (it's pronounced "why-bick")
#! /usr/bin/perl -w # netsnmpTinker.pl # ybiC 2001-05-18 13:30 # derived from Net::SNMP example1.pl # online MIB browser at http://www.ibr.cs.tu-bs.de/cgi-bin/sbrowser.cg +i use strict; use Net::SNMP; use Tie::IxHash; my %snmp; ($snmp{session}, $snmp{error}) = Net::SNMP->session( -hostname => shift || 'localhost', -community => shift || 'public', -port => shift || 161, ); tie my %mib, "Tie::IxHash"; %mib = ( # sysDescr => '1.3.6.1.2.1.1.1.0', sysUpTime => '1.3.6.1.2.1.1.3.0', sysContact => '1.3.6.1.2.1.1.4.0', sysName => '1.3.6.1.2.1.1.5.0', sysLocation => '1.3.6.1.2.1.1.6.0', ifNumber => '1.3.6.1.2.1.2.1.0', cdpAddress => '1.3.6.1.4.1.9.9.23.1.2.1.1.4', cdpDeviceID => '1.3.6.1.4.1.9.9.23.1.2.1.1.6', cdpHWtype => '1.3.6.1.4.1.9.9.23.1.2.1.1.8', ); unless (defined($snmp{session})) { printf(" Error: %s.\n", $snmp{error}); exit 1; } printf("\n Host = %s\n", $snmp{session} ->hostname()); for(keys %mib) { if (defined($snmp{response} = $snmp{session}->get_request($mib{$_}) +)) { printf(" $_ = %s\n", $snmp{response}->{$mib{$_}}); } else { print " $_ = not responding\n"} } $snmp{session}->close(); print "\n"; exit 0;

In reply to Re:(2) uninit value, Tie::IxHash, Net::SNMP (thanks, working snippet) by ybiC
in thread uninitialized value with Tie::IxHash and Net::SNMP by ybiC

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.