penguinfuz has asked for the wisdom of the Perl Monks concerning the following question:
The %oids hash seems to be overwriten with each loop, leading me to re-think the process. I was previously pushing the above data onto an array, but I need to keep the label and 'return values' together for later pushing into a db.$direction = shift; %iface = ( "if${direction}Octets.2" => 'FastEthernet0/1', "if${direction}Octets.3" => 'FastEthernet0/2', "if${direction}Octets.4" => 'FastEthernet0/3', "if${direction}Octets.5" => 'FastEthernet0/4', "if${direction}Octets.26" => 'GigabitEthernet0/1', ); foreach my $oid (sort keys(%iface)) { %oids = ("$iface{$oid}" => `$snmpwalk $ip $community $oid`); }
However, I am not exactly sure how to get the data pairs back out of the @oids array. Can anyone nudge me in the right direction?foreach my $oid (sort keys(%iface)) { @oids = ({"$iface{$oid}" => `$snmpwalk $ip $community $oid`}); }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: hashing it out.
by graff (Chancellor) on May 10, 2002 at 22:19 UTC | |
by penguinfuz (Pilgrim) on May 15, 2002 at 17:05 UTC | |
Re: hashing it out.
by Anonymous Monk on May 10, 2002 at 22:17 UTC | |
Re: hashing it out.
by lshatzer (Friar) on May 10, 2002 at 22:45 UTC | |
Re: hashing it out.
by dsheroh (Monsignor) on May 11, 2002 at 13:53 UTC | |
Re: hashing it out.
by yodabjorn (Monk) on May 11, 2002 at 10:43 UTC | |
A reply falls below the community's threshold of quality. You may see it by logging in. |