1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
#!/usr/bin/perl use strict; use warnings; use XML::Simple; my $data = { communities => [ { name => 'perl-community.de', url => 'http://www.perl-community.de', }, { name => 'otrs-community', url => 'http://www.otrs.org', }, ], }; my $xs = XML::Simple->new; my $xml = $xs->XMLout( $data ); print $xml;
1
2
3
4
5
perl xml_simple.pl
<opt>
<communities name="perl-community.de" url="http://www.perl-community.de" />
<communities name="otrs-community" url="http://www.otrs.org" />
</opt>