<HTML dir=ltr><HEAD>
<META http-equiv=Content-Type content="text/html; charset=unicode">
<META content="MSHTML 6.00.2900.3492" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face="Courier New" color=#000000 size=2>Later he decided he wanted elements instead of attributes. :)</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>j</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>$ cat j.pl<BR>#!/usr/bin/perl<BR><BR>use strict;<BR>use XML::Twig;<BR>my $twig = XML::Twig->new(<BR> pretty_print => 'indented'<BR>)->parse('<users/>')->root;<BR><BR><BR>my @users = (<BR> { firstname => 'Jay',<BR> lastname => 'Hannah'<BR> },<BR> { firstname => 'Quentus',<BR> lastname => 'Rex'<BR> },<BR>);<BR><BR>foreach my $user (@users) {<BR> my $user_xml = XML::Twig::Elt->new('user');<BR> foreach my $att (keys %$user) {<BR> my $xml = XML::Twig::Elt->new($att, $user->{$att});<BR> $xml->paste( last_child => $user_xml );<BR> }<BR> $user_xml->paste( last_child => $twig );<BR>}<BR>print $twig->sprint;<BR><BR>$ perl j.pl<BR><users><BR> <user><BR> <firstname>Jay</firstname><BR> <lastname>Hannah</lastname><BR> </user><BR> <user><BR> <firstname>Quentus</firstname><BR> <lastname>Rex</lastname><BR> </user><BR></users><BR></FONT></DIV><PRE><FONT size=2></FONT> </PRE></BODY></HTML>