title: How can I decode UTF-16 data in Perl when I don't know the byte order?
body: <p>If I open a file ( and specify an encoding directly ) :</p>
  
  <pre><code>open(my $file,"&lt;:encoding(UTF-16)","some.file") || die "error $!\n";
  while(&lt;$file&gt;) {
      print "$_\n";
  }
  close($file);
  </code></pre>
  
  <p>I can read the file contents nicely. However, if I do:</p>
  
  <pre><code>use Encode;
  
  open(my $file,"some.file") || die "error $!\n";
  while(&lt;$file&gt;) {
      print decode("UTF-16",$_);
  }
  close($file);
  </code></pre>
  
  <p>I get the following error:</p>
  
  <pre><code>UTF-16:Unrecognised BOM d at F:/Perl/lib/Encode.pm line 174
  </code></pre>
  
  <p>How can I make it work with <code>decode</code>?</p>
  
  <p>EDIT: here are the first several bytes:</p>
  
  <pre><code>FF FE 3C 00 68 00 74 00
  </code></pre>