use XML::Generator; my $x = XML::Generator->new('escape' => 'always', 'conformance' => 'strict'); print $x->foo($x->bar({baz=>3}, $x->bam()), $x->bar(['qux'],"Hey there,\n", "world")); #### Hey there, world