Thanks for all the help. The final code is posted below, well a base functionality skeleton is at least, including the trial SNMPget call. It returns a hash instead of a value, but at least now I know that the communication syntax is correct. If anyone has hints as to how to get a value instead of a hash out of the call, that would be appreciated. Here's the code now, with "use strict" enabled.
#!/usr/bin/perl -w use strict; #modules used use XML::Simple; use Data::Dumper; use Net::SNMP; our ($data, $xml, $e, $Host, $OID, $port, $value, $IPAddressA, $sessio +n, $error); #create object $xml = new XML::Simple; # MIB Hard value taken from parameters of the DC1 fab port pairs scrip +t appended a 1 to test port #1 $OID = ".1.3.6.1.4.1.289.2.1.1.2.3.1.1.152.1"; #checking against PD110 as a test run will probably be read from an XM +L input file in the future $Host = "10.2.125.110"; # read the XML file $data = $xml->XMLin("FabPortPairs.xml"); #print Dumper($data); foreach $e (@{$data->{PairedDevices}}) #Do actions that require use of XML data in this loop possibly #call SNMP data gathering and reporting { print "Pairname is: " . $e->{PairName} . "\n "; print "Hosted Apps are: " . $e->{HostedApplication} . "\n" ; print "HostOS is: " . $e->{HostOS} . "\n"; $IPAddressA = $e->{DeviceA}->{IPAddress} ; print "Var name for IpAddressA is " . $IPAddressA . "\n"; } ##test SNMP code print "SNMP test run \n"; ($session,$error) = Net::SNMP->session(Hostname => $Host, Community => "public"); die "session error: $error" unless ($session); $value = $session->get_request($OID); die "request error " . session->error unless (defined $value); $session->close; print "port info: " . $value . "\n";

In reply to Re^4: Accessing 2nd level elements in XML::Simple and using the data in an SNMP call by wruehl
in thread Accessing 2nd level elements in XML::Simple and using the data in an SNMP call by wruehl

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.