I want to remove a utf8 BOM from a .pl file. I can do it by using an another perl script to process the file like so:
But why can't I just do it like this in vim when editing the file itself?while ( my $line = <IN> ) { $line =~ s/^\x{FEFF}//; print OUT $line;
That doesn't match the BOM. I'm a rookie, so maybe I'm making a rookie mistake.s/^\x{FEFF}//g
Thanks, zod
UPDATE: Just for the sake of completeness if anyone wonders about this later: The BOM is not considered part of the text of the file you are editing in VIM. Vim strips the BOM when the file is opened and sets the local 'bomb' option to remember that it must be added back when writing the file. So you can't pattern match it because it isn't there while you have the file open in VIM. See here.
In reply to Remove BOM ? by zod
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |