Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: XML::Simple / XMLout Question

by hdb (Monsignor)
on Aug 25, 2017 at 07:56 UTC ( #1197992=note: print w/replies, xml ) Need Help??


in reply to XML::Simple / XMLout Question

XMLout seems to expect a Perl structure not a string, so why don't you build it like this:

use strict; use warnings; use XML::Simple qw(XMLout); my $VAR1 = "bla1"; my $VAR2 = "bla2"; my $VAR3 = "bla3"; my $VAR4 = "bla4"; my $xml = { source=>[{ abc=>[{ uname=>[$VAR1], dbcrdn=>[$VAR2], paridn=>[$VAR3], osath=>[$VAR4], }] }] }; print XMLout($xml,RootName => "root");

or more interactively

use strict; use warnings; use XML::Simple qw(XMLout); my $VAR1 = "bla1"; my $VAR2 = "bla2"; my $VAR3 = "bla3"; my $VAR4 = "bla4"; my $abc; push @$abc, { uname=>[$VAR1], dbcrdn=>[$VAR2], paridn=>[$VAR3], osath= +>[$VAR4], }; my $xml; push @{$xml->{"source"}}, { abc => $abc }; print XMLout($xml,RootName => "root");

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1197992]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (2)
As of 2022-05-22 12:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (80 votes). Check out past polls.

    Notices?