in reply to Remove BOM ?
open IN, ':<encoding(UTF-8)', $file or die $!; # your code here
If you don't decode the file, you have to remove the byte sequences that represent the BOM in the encoding that your file has.
Update: The big difference between vim and perl (in this respect) is that vim tries to auto-detect the character encoding (which is a sane thing to do for a text editor, especially if the text are longer, and represent human language) and decodes the text with the guessed encoding, while perl doesn't try to guess anything (which is a sane thing to do for a general purpose programming language).
|
|---|