Data structures have always confused me. Either I get lost when I'm trying to access the nested elements or I just get frustrated take the easy way out to solve a problem.

Let's say I have this hash of hashes:
config = {
       "somehost" => {
     	"user" => "bivouac",
     	"host" => "",
     	"r_log" => "/home/bivouac/logs"
       "another_host" => {
     	"user" => "someone_else",
     	"host" => "",
     	"r_log" => "/var/tmp/logs"
This is how I'm accessing the elements of the data structure via the command line:
machine = ARGV[0]
    user = config[machine]["user"]
    host = config[machine]["host"]
    r_log = config[machine]["r_log"]
    puts [user, host, r_log].join("\t")
Seems too remedial. I already have the variable names (user, host, r_log) so it just seems overkill that I'm using them twice as var names and as hash keys. Anyway...

This is the output:
$ ruby hash.rb somehost
  bivouac		/home/bivouac/logs
I was looking through the Ruby docs and the Pickaxe and I know that the 'hash' object has a 'each_key' method that you can use to access the keys of a hash, but what if those keys access another hash.

Two questions really, what's a more elegant solution and anyone have a good tutorial on data structures could be in any language like PHP, Python or Perl. Just looking for better grounding when I run into these problems.