in reply to how to replace the <anon> tag (XML::Simple)

use strict; use warnings; use XML::Simple ; my @doc = { a => 'a', b => 'b' } ; my $xs = new XML::Simple(RootName => 'something_else'); print $xs->XMLout({record => \@doc}, noattr => 1, xmldecl => '<?xml version="1.0">');

Prints:

<?xml version="1.0"> <something_else> <record> <a>a</a> <b>b</b> </record> </something_else>

DWIM is Perl's answer to Gödel

Replies are listed 'Best First'.
Re^2: how to replace the <anon> tag (XML::Simple)
by johngg (Canon) on Apr 19, 2006 at 12:34 UTC
    I'm puzzled by the curlies on your line

    my @doc = { a => 'a', b => 'b' } ;

    Shouldn't it read

    my @doc = ( a => 'a', b => 'b' ) ;

    I guess I'm missing something obvious.

    Cheers,

    JohnGG

      or:

      my %doc = (a => 'a', b => 'b');

      OP's code was so syntacticlly challenged that that (introduced) foible sliped through while I was cleaning up the issues raised by adding the strictures.

      The result is the same in this case in any case and is not pertinent to OP's problem - but worth pointing out.


      DWIM is Perl's answer to Gödel
        "syntactically challenged", I like that :-)