ruthiepj has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to determine if a particular XML file has a node. I'm parsing through each of the nodes and updating one of the child nodes but for rerun ability I don't want to update it if the values haven't changed. I'm running into an instance where one of my child nodes doesn't exist. In that case I want to skip that update. It is failing because $i for item($i) ($i could be anything from 0 to 9) doesn't exist. In this case it is item(0). I'm trying to figure out a way to find out if put an undef reference or code this a different way so it doesn't fail just skips the if statement.
my $length = $objXmlConfig->getElementsByTagName"comments_en-US")->get +Length; DEBUG "length " .$length; if ($objXmlConfig->getElementsByTagName("comments_ +en-US")->getLength > 0){ $comments = $objXmlConfig->getElementsByTagNam +e("comments_en-US")->item($i)->getFirstChild->getNodeValue; }