in reply to Help with string concat and sockets

Hard to say...could be some escape characters sneaking in. Try making the test lines more unique, i.e.
bla1 abc def ghi end
and stick a newline and a delimeter by replacing
$testXML = join '', $testXML, $_; WITH $testXML .= "**$_**\n";
and see if that helps to debug it at all...