in reply to For loop problem

What makes you think the for loop doesn't iterate correctly? It won't do much after the first iteration, but that's because in the first iteration, you plow through $output_XML_A_open (reaching the end), so the body of the while is never entered after the first iteration of the for.

Abigail