Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: Need help with XML::Twig, something strange is happening!!by rhesa (Vicar) |
on Mar 28, 2007 at 13:55 UTC ( [id://607026]=note: print w/replies, xml ) | Need Help?? |
Consider using the numerical comparison operators. You're dealing with numbers, so you shouldn't compare them as strings.
Try if ($ParentNodeId > 1) { instead of if ($ParentNodeId gt 1) {. Replace eq with ==.
While I'm here, can I suggest you use a hash for the input data, instead of that long list of variables? First define a list of field names:
Then replace the split line with Then when you set the attributes on the XML::Twig::Elt, you can simply say:
In Section
Seekers of Perl Wisdom
|
|