See your problem is you're using XML::Simple, switch to XML::Rules and your problem will go away :) Re^3: Parsing XML (XML::Rules xml2XMLRules )
#!/usr/bin/perl -- #~ xml-simple-to-xml-rules-1089765.pl #~ 2014-06-12-23:31:16 by Anonymous Monk #~ #~ #~ perltidy -csc -otr -opr -ce -nibc -i=4 #!/usr/bin/perl -- use strict; use warnings; use XML::Rules; use XML::Simple qw/ XMLin /; use Data::Dump qw/ dd /; my $shortxmlraw = q{<?xml version='1.0'?> <employees> <employee> <name>John Doe</name> <age>43</age> <sex>M</sex> <department>Operations</department> </employee> <employee> <name>Jane Doe</name> <age>31</age> <sex>F</sex> <department>Accounts</department> </employee> </employees>}; my $xmlin = XML::Rules->new( qw/ stripspaces 8 /, rules => ## the result of xml2XMLRules foo.xml foo2.xml .... { 'age,department,name,sex' => 'content', 'employee' => 'as array no content', 'employees' => 'no content' }, ); dd({ YES => $xmlin->parse( $shortxmlraw ) }); dd({ NO => XMLin( $shortxmlraw ) }); __END__ { YES => { employees => { employee => [ { age => 43, department => "Operations", name => "John +Doe", sex => "M" }, { age => 31, department => "Accounts", name => "Jane Do +e", sex => "F" }, ], }, }, } { NO => { employee => { "Jane Doe" => { age => 31, department => "Accounts", sex = +> "F" }, "John Doe" => { age => 43, department => "Operations", sex + => "M" }, }, }, }

In reply to Re: XML::Simple Not getting the proper output. ( xml2XMLRules by Anonymous Monk
in thread XML::Simple Not getting the proper output. by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.