in reply to Nested Hash/Arrays Access

You are thinking about hashes of hashes in the incorrect way. Hash elements and array elements must be scalars, so when dealing with a complex structure you are really storing hash references (pointers to hashes) in the hash. So rather than the nested access approach you have, reading a deep entry should look like

$servers{$server}{$process}

which is short hand for

$servers{$server}->{$process}

This means, for iterating through a hash of hashes using keys, your code should look like:

foreach $server (keys %servers) #returns individual servers { print "$server\n"; foreach $process (keys %{$servers{$server}}) #returns individu +al processes on a server { print "$process\n"; foreach $processPart (keys %{$servers{$server}{$proces +s}}) # returns part of a process { print "$processPart\n"; } } }

For some more details on these types of structures, you should probably read perllol.

Replies are listed 'Best First'.
Re^2: Nested Hash/Arrays Access
by AnomalousMonk (Archbishop) on Jul 20, 2009 at 16:20 UTC
Re^2: Nested Hash/Arrays Access
by Wookimonsta (Initiate) on Jul 21, 2009 at 10:13 UTC
    thank you, this fixed my problem perfectly. i was thinking of it in a C way. thanks for the help