in reply to How can I replace a line (tag) in an XML file?
but i recommend you to build a hash of your data within perl and export it via "save($filename,\%hashref);"use strict; use XML::Simple; $filename = "yours.xml"; xml_edit($filename); # return done 1 || error 0 sub xml_edit($){ my$bool=0; %DB=load($_[0]); if(exists$DB{student}{id}{2}) { $DB{student}{gpa}='C'; $bool++; } save($_[0],\%DB); return$bool; } #untested
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How can I replace a line (tag) in an XML file?
by Jenda (Abbot) on Sep 29, 2011 at 10:19 UTC | |
by AlexTape (Monk) on Sep 29, 2011 at 10:52 UTC |