Yes, I found the problem. The data did have the UTF8 BOM. I didn't notice the BOM until I analyzed the bytes (od -x). The issue was that perl was converting the BOM (EFBBBF) to ISO-88591-1 even though I indicated that my output should be UTF8 (open, ">:utf8", $name). The fix was to also open the input with the utf8 encoding. That is my original statement was open (INPUT, "< $inputfile") so I changed that to open (INPUT, "<:utf8", "$inputfile"). Thanks to all for the help with this. Once I realized that the input file really had the BOM, the fix was easy.