in reply to Re^2: How do I delete a specific element from an XML file
in thread How do I delete a specific element from an XML file

I found the problem, it come from with the exit command. WIth this it works well
delete $category->{'subcategory'}[$countersubs]{'product'}[$counterpro +d]{'channel'}[$counterchan]
only when all loops is finished their process.