in reply to Writing Out XML using XML::Simple

If you want XML::Simple to write the XML out to a file rather than returning a string, then you could use the 'outputfile' option:

XMLout($config, outputfile => 'your_filename_here');

Also, I notice you're not specifying any options on your call to XMLin(). I would think you should be using at least:

my $config = XMLin(undef, forcearray => [ 'item'code ]);

For more details of why you don't want to rely on the defaults, see this node.