in reply to Re^3: Not sure how to populate a hash
in thread Not sure how to populate a hash

Thanks so much for your help guys. I mostly get this now!

Just one last question. If I wanted to return the attributes of one of the servers as a hash, how do I get to that data?

So in other words, I want to a create a simple hash %server_properties which name value pairs of one of the servers?

Replies are listed 'Best First'.
Re^5: Not sure how to populate a hash
by LanX (Saint) on Sep 24, 2014 at 13:35 UTC
    This creates a copy (NOT an alias i.e. writing to it won't change the original data)

     %server_properties = %{$nodemetrics{server1}}

    Otherwise

    $h_server1 = $nodemetrics{server1}

    (like already shown) is the same hashref, which can be safely changed

    $h_server1->{cpu}=100 or alternatively $$h_server1{cpu}=100

    see perlref and perldsc for details!

    Cheers Rolf

    (addicted to the Perl Programming Language and ☆☆☆☆ :)