Note: There is absolutely no "hex encoding" in my solution. I added a hex dump of my result in order to display the control characters (and ASCII zero's) unambiguously in this forum.
Bill
Comment on Re^3: Help adding STX and ETX to data string in Perl