PerlIO::encoding(3pm)
π NAME π
PerlIO::encoding β encoding layer π
okay bestie, welcome to the PerlIO::encoding page from the Perl Programmers Reference Guide, manual section 3pm. This is the encoding layer, and it's literally here to open a filehandle with a transparent encoding filter. Slay.
β¨ SYNOPSIS β¨
Here's the whole little group chat, exactly:
use PerlIO::encoding;
open($f, "<:encoding(foo)", "infoo");
open($f, ">:encoding(bar)", "outbar");
use Encode qw(:fallbacks);
$PerlIO::encoding::fallback = FB_PERLQQ;
π¦ DESCRIPTION π¦
This PerlIO layer opens a filehandle with a transparent encoding filter. No cap, that's the whole main character energy.
On input, it converts the bytes expected to be in the specified character set and encoding into Perl string data (Unicode and Perl's internal Unicode encoding, UTF-8). So the bytes come in, and the Perl string data comes out looking right. π
On output, it flips the vibe: it converts Perl string data into the specified character set and encoding. Iconic.
When the layer is pushed, the current value of $PerlIO::encoding::fallback is saved and used as the CHECK argument when calling the Encode methods encode() and decode(). That's the key little detail β it's saved at push time, bestie.
π SEE ALSO π
openEncode"binmode" in perlfuncperluniintro
π«Ά aaaand that's the page, bestie! thisPerlIO::encoding(3pm)one comes fromperlv5.42.3and is dated2026-11-03. periodt. π β¨
π¦ 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