http://qs321.pair.com?node_id=508466

lepetitalbert has asked for the wisdom of the Perl Monks concerning the following question:

Hi dear Monks

I'm trying to learn 'complex'(for me) data structs. I never use more than a key/value hash.

Now I need something like :

%host { 'ip1' => { 'tcp' => { '21' => { 'state' => open; 'service' => ftp; }, '80' => { 'state' => open; 'service' => web; } } } }, 'ip2' => { 'tcp' => { '23' => { 'state' => open; 'service' => telnet; }, '80' => { 'state' => open; 'service' => web; } } } } };

I have read hash tutorials for two days, but have still no idea how to loop through this to print :

ip1 21 open ftp 80 open web ip2 23 open telnet 80 open web

or how to add 53 open dns to ip1

Have a nice day