If I understand what you are doing, the problem is that you are trying to use the same handle to iterate through the file multiple times. That won't work. You need to open and close the file inside the for loop (or play games with seek).
Some quick comments:
use strict
check return code from IO operations (like open)
You have an handle opened for input named OUTPUT_XML_A_OPEN. That is confusing.
while (my $line = <OUTPUT_XML_A_OPEN>) would be less confusing than what you have.
Hope this helps,
-pete
"Worry is like a rocking chair. It gives you something to do, but it doesn't get you anywhere."