How can I create XML from Perl?

后端 未结 6 821
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-05 04:52

I need to create XML in Perl. From what I read, XML::LibXML is great for parsing and using XML that comes from somewhere else. Does anyone have any suggestions for an XML

6条回答
  •  难免孤独
    2020-12-05 05:13

    If you want to take a data structure in Perl and turn it into XML, XML::Simple will do the job nicely.

    At its simplest:

    my $hashref = { foo => 'bar', baz => [ 1, 2, 3 ] };
    use XML::Simple;
    my $xml = XML::Simple::XMLout($hashref);
    

    As its name suggests, its basic usage is simple; however it does offer a lot of features if you need them.

    Naturally, it can also parse XML easily.

提交回复
热议问题