#!c:\Perl\bin\perl use SNMP; my $s = new SNMP::Session(DestHost => 'localhost', Community => 'public', 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}{'hrSWInstalledIndex'}\n"; print "Key = $key - 'hrSWInstalledName' = $$j{$key}{'hrSWInstalledName'}\n"; print "Key = $key - 'hrSWInstalledID' = $$j{$key}{'hrSWInstalledID'}\n"; print "Key = $key - 'hrSWInstalledType' = $$j{$key}{'hrSWInstalledType'}\n"; print "Key = $key - 'hrSWInstalledDate' = $$j{$key}{'hrSWInstalledDate'}\n"; }