Thanks Psycho!
I have read through your suggested modifications and yes, I understand now using $line vs $lineAry. Also thank you for adding the comments expanding with the additions such as echoing the Found: etc. It helps me understand a lot clearer.
Good news, I have made the changes and tested the new code. It works very well, however I must troubleshoot the portArray section, as I am now getting duplicate port numbers and hostnames inserted from the xml files. Thought it may have been multiple nmap scan xml files (different days with IP's changing dynamically which would account for multiple hostnames showing up), but when I try the code with a single xml nmap output I still have multiple ip's showing the same hostname, and the port lists are doubled up. Strangely, the order is not repetitive though.
Data Added: 192.168.x.x - xx:xx:xx:xx:xx:xx - LCFC(HeFei) Electronics Technology - xxxxxxxxxx.local - 22, 80, 443, 80, 80, 80, 22, 80, 443, 22, 80, 443, 7, 9, 13, 17, 19, 135, 139, 5800, 5900, 27000, 21, 22, 80, 111, 139, 443, 445, 548, 554, 2049, 3261, 5000, 5001, 9900, 80, 443, 5060, 5061, 139, 445, 3389, 80, 443, 554, 1935, 6001, 8000, 9000, 80, 443, 554, 1935, 6001, 8000, 9000, 139, 445, 3389, 254, 616, 631, 726, 777, 1044, 1148, 1556, 1998, 2179, 2998, 3546, 4899, 4900, 5061, 5087, 6106, 7103, 15004, 49152, 56738, 62078, 22, 80, 139, 445, 3389, 135, 139, 445, 3306, 3389, 80, 443, 135, 139, 445, 3389, 139, 445, 80, 135, 139, 443, 445, 1311, 3306, 3389, 8042, 135, 139, 445, 80, 111, 139, 443, 445, 554, 2049, 3260, 3261, 4045, 5000, 5001, 5357, 5510, 9900, 139, 445, 3389, 135, 139, 445, 3389, 139, 445, 3389, 8080, 22, 80, 443, 5900, 139, 445, 3389, 80, 443, 554, 1935, 6001, 8000, 9000, 53, 80, 135, 139, 445, 1433, 1801, 2103, 2105, 2107, 3389, 8002, 9102, 135, 139, 443, 445, 2179, 3389, 80, 443, 139, 445, 3389, 80, 111, 139, 443, 445, 554, 2049, 3260, 3261, 4045, 5000, 5001, 5357, 5510, 9900, 53, 80, 135, 139, 445, 1433, 1801, 2103, 2105, 2107, 3389, 8002, 9102, 139, 445, 3389, 21, 80, 111, 139, 445, 2049, 5357, 8001, 8002, 49154, 80, 443, 3389, 139, 445, 3389, 80, 443, 139, 445, 3389, 135, 139, 445, 2000, 2100, 2638, 139, 445, 3389, 139, 445, 135, 139, 445, 5357, 25, 80, 135, 139, 445, 1311, 1433, 2525, 3030, 3389, 25734, 25735, 139, 445, 3389 - 1703125643
Thank you, I appreciate your time, effort and quick response. I have learned from your suggestions.