Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Hash of Hashes, referencing, dereferencing and Net::SNMP

by matija (Priest)
on Oct 06, 2004 at 12:16 UTC ( #396958=note: print w/ replies, xml ) Need Help??


in reply to Hash of Hashes, referencing, dereferencing and Net::SNMP

Well, the problem is here:

$results_table->{$$group}}->{$$site_name} = { sysobjid => "unknown", snmp_status => "NOT OK +", };
Contrary to what might be convenient, you are assigning a whole new hash reference (and leaving the old hash orphaned and subject to garbage collection).

You will have to break the statement down into two parts:

results_table->{$$group}}->{$$site_name}->{sysobjid}="unknown; results_table->{$$group}}->{$$site_name}->{snmp_status}="NOT OK";


Comment on Re: Hash of Hashes, referencing, dereferencing and Net::SNMP
Select or Download Code
Replies are listed 'Best First'.
Re^2: Hash of Hashes, referencing, dereferencing and Net::SNMP
by Smylers (Pilgrim) on Oct 06, 2004 at 15:28 UTC
    You will have to break the statement down into two parts:
    results_table->{$$group}}->{$$site_name}->{sysobjid}="unknown; results_table->{$$group}}->{$$site_name}->{snmp_status}="NOT OK";

    If you want to put the convenience back then use a fake loop to avoid the repetition:

    for ($results_table->{$$group}{$$site_name}) { $_->{sysobjid} = 'unknown'; $_->{snmp_status} = 'NOT OK'; }
    Smylers
Re^2: Hash of Hashes, referencing, dereferencing and Net::SNMP
by revdiablo (Prior) on Oct 06, 2004 at 18:08 UTC
    You will have to break the statement down into two parts

    Another approach would be using a hash slice:

    my $site = results_table->{$$group}->{$$site_name}; # for convenience @{ $site }{("sysobjid", "snmp_status")} = ("unknown", "NOT OK");

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://396958]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (13)
As of 2015-07-29 18:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (267 votes), past polls