source::encoding(3pm)
π NAME π
Okay bestie, this is source::encoding(3pm) from the Perl Programmers Reference Guide π Itβs literally called source::encoding β and its whole personality is declare Perl source code encoding. Periodt.
β¨ SYNOPSIS β¨
use source::encoding 'ascii';
use source::encoding 'utf8';
no source::encoding;
πΈ DESCRIPTION πΈ
So these days, bestie, Perl code is usually doing one of two things: itβs generally only ASCII characters, with \x{} and similar escapes standing in for the non-ASCII bits, or itβs got use utf8 to say βhey, the source code itself contains characters encoded as UTF-8β β¨
That means when a character in the source code doesnβt meet those criteria, itβs often a typographical error π This pragma is the one that tells Perl to raise an error when that happens. No silent weirdness, no cap.
use source::encoding 'utf8'is a synonym foruse utf8β they may be used interchangeably πuse source::encoding 'ascii'turns off any UTF-8 expectations, and raises a fatal error if any character within its scope in the input source code is not ASCII (or ASCII-equivalent on EBCDIC systems) π¨no source::encodingturns off any UTF-8/ASCII expectations for the remainder of its scope. After that, the meaning of non-ASCII characters is undefined π so donβt come crying to me if it gets feral.use source::encoding 'ascii'is automatically enabled within the lexical scope of ause v5.41.0or higher π
π¦ SEE ALSO π¦
utf8β thatβs the whole vibe check π«Ά
mwah π β this page is source::encoding(3pm) from perl v5.42.3, dated 2026-11-03. Byeee π
π¦ where this page comes from
- alpine 3.24: perl-doc 5.42.3-r0 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms