What is the best way to write and read XML in perl?

Grace_Virginia

New Member
I am working with Perl programs that write to an XML file by just using the typical functions open, print, close. The XML files are later digested by a PHP Web application.\[code\]#!/usr/bin/perl#opening fileopen FILE, ">derp.xml" or die $!;#data is created in variables like so...$first = '<\?xml version=\"1.0\" encoding=\"UTF-8\" \?>';$openperson = '<person>\n';$name = '<name>Gary</name>\n';$birthday = '<brithday>01/10/1999</birthday>\n';$car = '<car>minivan</car>\n';$closeperson = '</person>\n';#writing variables to fileprint FILE $first;print FILE $openperson;print FILE $name;print FILE $birthday;print FILE $car;print FILE $closeperson;close FILE;\[/code\]More or less this is basically how the current system works. I am sure there must be a better way.
 
Back
Top