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