UTF-8 can also be guessed, but it is harder and can be mixed up with some legacy encoding.

Not really. The problem is the amount of lookahead needed. With a BOM, one can be sure after reading just a few bytes.

In reply to Re^3: perltidy and UTF-8 BOM by ikegami
in thread perltidy and UTF-8 BOM by morelenmir

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":