topical media & game development

talk show tell print

professional-xml-17-perl-writexml.pl / pl



  use XML::Simple;
  
  my cfg = {'version' => '1.0',
                                                  'section' => {
                                                          'name' => 'Section 1', 
                                                          'setting' => [
                            {
                              'name' => 'Setting#1',
                              'value' => 'Value#1'
                            },
                            {
                              'name' => 'Setting#2',
                              'value' => 'Value#2'
                            },
                            {
                              'name' => 'Setting#3',
                              'value' => 'Value#3'
                            }
                          ]
                    }
            };
  
  # write out Perl variable
  print XMLout(cfg, RootName=>'configuration', XMLDecl=>1);


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.