What I'm trying to do is this:
#!c:\Perl\bin\perl use SNMP; my $s = new SNMP::Session(DestHost => 'localhost', Community => 'publ +ic', Version => '2'); # gets an snmp table and returns a hashref in $j my $j = $s->gettable('hrSWInstalledTable'); # This statement returns the number of keys in the hashref. $numOfKeys = scalar keys %$j; # print out all of the values in the table for($key = 1; $key <= $numOfKeys; $key++) { print "Key = $key - 'hrSWInstalledIndex' = $$j{$key}{'hrSWInstall +edIndex'}\n"; print "Key = $key - 'hrSWInstalledName' = $$j{$key}{'hrSWInstall +edName'}\n"; print "Key = $key - 'hrSWInstalledID' = $$j{$key}{'hrSWInstall +edID'}\n"; print "Key = $key - 'hrSWInstalledType' = $$j{$key}{'hrSWInstall +edType'}\n"; print "Key = $key - 'hrSWInstalledDate' = $$j{$key}{'hrSWInstall +edDate'}\n"; }
However, the hrSWInstalledDate doesn't print correctly as you can see in the output below.

C:\perlprograms>perl snmp_test.pl
Key = 1 - 'hrSWInstalledIndex' = 1
Key = 1 - 'hrSWInstalledName' = Emaga4 Game Resources 1.0
Key = 1 - 'hrSWInstalledID' = zeroDotZero
Key = 1 - 'hrSWInstalledType' = 4
Key = 1 - 'hrSWInstalledDate' = ╓ ►"
Key = 2 - 'hrSWInstalledIndex' = 2
Key = 2 - 'hrSWInstalledName' = 3DGPAi1 Game Resources 1.0
Key = 2 - 'hrSWInstalledID' = zeroDotZero
Key = 2 - 'hrSWInstalledType' = 4
Key = 2 - 'hrSWInstalledDate' = ╓ ♥↕+*

I need some way to convert the value returned for hrSWInstalledDate to a human readable and printable format. Any help is greatly appreciated.
Thanks
perlchild

In reply to Convert Octet String DateAndTime to printable string by perlchild

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.