#Update the text in the comment. my ($first_comment) = $doc->findnodes("/comment()[1]"); my $timestamp = POSIX::strftime("%Y%m%d%H%M%S", localtime); my $new_comment = qq(Saved by $0 on $timestamp from $ENV{COMPUTERNAME} by user $ENV{USERNAME}); $first_comment->setData($new_comment); #Update the regular text node. my ($Appname_node) = $doc->findnodes("/Testing/name1/Appname"); $Appname_node->removeChildNodes(); $Appname_node->appendText($0);