in reply to read through \x0a in data piped via STDIN

But something wierd happens with the 0x0a

Well, <...>, aka readline, by definition reads up to the next input record separator, which by default is a newline, i.e. \n or 0x0a.

You could change $/ ...