Isnt it enough that it has it in the shebang line as well '#!/usr/bin/perl' ?
What's "it"?, the "#!"? No. When I said it has to be the very first thing in the file, I meant it has to be the very first thing in the file.
$ od -c a.pl
0000000 357 273 277 # ! / u s r / b i n / p
+e
0000020 r l \n p r i n t ( " H e l l o
0000040 W o r l d \ n " ) ; \n \n
0000054
$ a.pl
-bash: ./a.pl: cannot execute binary file
$ perl -i.bak -ple"s/^\xEF\xBB\xBF// if $.==1" a.pl
$ od -c a.pl
0000000 # ! / u s r / b i n / p e r l \
+n
0000020 p r i n t ( " H e l l o W o
+r
0000040 l d \ n " ) ; \n \n
0000051
$ perl a.pl
Hello World
i tried clciking the link with BOM but it wont load
It's the Wikipedia page on "byte-order mark". I don't see why you couldn't load it.
When a script source is considered to be utf-8?
Either it is or it isn't. There's no "considered" about it. If you saved it using UTF-8 as the encoding, it's UTF-8. If you used another encoding, it isnt.
But yes, I meant when the source is UTF-8.
Perl will assume the source is encoded using iso-8859-1 unless use utf8; is used.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|