use strict; use warnings; use XML::Element; my $root = new XML::Element('root'); foreach my $app ( keys %appsrvr ) { my $el = new XML::Element( $app , %{$appsrvr{$app}} ); $root->push_content($el); } print $root->as_XML();