bytes
use bytes; no bytes;
The bytes pragma disables character semantics for the rest of the
lexical scope in which it appears. The no
bytes pragma can be used to reverse the effect of use bytes within the current lexical
scope.
Perl normally assumes character semantics in the presence of character data (that is, data from a source marked as being of a particular character encoding).
To understand the implications and differences between character semantics and byte semantics, see Chapter 6. A visit to Tokyo might also help.
You probably don’t want to use this pragma, and it’s likely to
disappear in later versions of Perl. In v5.14, the bytes pragma’s documentation strongly
discourages its use. If you have a string, treat it as a character string
without worrying about its underlying encoding.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access