title: Remove BOM from string with Perl
body: <p>I have the following problem: I am reading from a UTF-8 text file (and I am telling Perl that I am doing so by ":encoding(utf-8)").</p>
  
  <p>The file looks like this in a hex viewer:
  EF BB BF 43 6F 6E 66 65 72 65 6E 63 65</p>
  
  <p>This translates to "∩╗┐Conference" when printed. I understand the "wide character" which I am being warned about is the BOM. I want to get rid of it (not because of the warning, but because it messes up a string comparison that I undertake later).</p>
  
  <p>So I tried to remove it using the following code, but I fail miserably:</p>
  
  <p>$line =~ s/^\xEF\xBB\xBF//;</p>
  
  <p>Can anyone enlighten me as to how to remove the UTF-8 BOM from a string which I obtained by reading the first line of the UTF-8 file?</p>
  
  <p>Thanks!</p>