#!/usr/bin/perl

print "Hello, World...\n";
use XML::Simple;
use Data::Dumper;

my $file = 'foo.xml';
my $xs1 = XML::Simple->new();
my $doc = $xs1->XMLin($file);
my $k;
my $k2;
my $k3;

##print Dumper($doc);
my $tree1 = 'config';
my $tree2 = 'server';
#foreach $k (keys (%{$doc->{config}->{'server'}})){
foreach $k (keys (%{$doc->{$tree1}->{$tree2}})){
	print "$k:\n";
	foreach $k2 (keys (%{$doc->{$tree1}->{$tree2}->{$k}})){
		##print $k2 . "\n";
		my @arr = $doc->{$tree1}->{$tree2}->{$k}->{$k2};
		my $cnt = @arr;
		print "$k2:$cnt: " . Dumper($doc->{$tree1}->{$tree2}->{$k}->{$k2}) . "\n";
		###foreach $k3 (keys (%{$doc->{$tree1}->{$tree2}->{$k}->{$k2}})){
		###foreach $k3 (@arr) {
		foreach $k3 ((@{$doc->{$tree1}->{$tree2}->{$k}->{$k2}})){
			#print "$k2:" . scalar @arr . ": " . Dumper(@arr) . "\n";
			print "$k2:$k3\n";
		}
	}
}