in reply to End Of File Marker

Using binmode will turn off all such special processing. So 0's won't be thrown away, ^Z won't mean EOF, etc. However, it won't normalize your EOLN characters, either.

So, after cutting out the passage of interest, if the code that processes the XML is thrown off by the presence of \r characters (it shouldn't be since it's not line oriented and \r is lumped together as "whitespace"), use tr/\r//d to zap them.

—John