Resources¶
One line: Every claim in this library can be checked against a perldoc page — the list below says which page stands behind which chapter — and every idea in it has a sibling page in another language, linked from the lesson itself.
The primary sources¶
perldoc ships with perl, so all of these are also on your machine: perldoc perlrun, perldoc -f split, perldoc Encode.
One-liners (chapter 01)
- perlrun ↗ — every switch:
-n,-p,-l,-a,-F,-i,-0,-C,-E. - perlvar ↗ —
$/,$\,$.,$ARGV,$^I. - B::Deparse ↗ — the module behind
-MO=Deparse.
Unicode text (chapter 02)
- perlunitut ↗, then perlunifaq ↗, then perluniintro ↗ — the order the encodings library's man-pages lesson ↗ recommends.
- perlunicode ↗ — the reference, including the section called "The Unicode Bug".
- perlunicook ↗ — short recipes, each one a line or two you can paste.
- Encode ↗, the open ↗ pragma and the utf8 ↗ pragma.
- Unicode::Normalize ↗ and fc ↗.
Regex (chapter 03)
- perlretut ↗ to learn, perlre ↗ to look up.
- perlrecharclass ↗ — what
\w,\d,\smatch, and the/aand/aamodifiers. - perlrebackslash ↗ —
\R,\X,\b. - perlop ↗ — "Regexp Quote-Like Operators":
m//gin both contexts,s///r,s///e,tr///. - feature ↗ —
unicode_strings, and whichuse v5.xxturns it on. - split ↗ and pos ↗.
Records and fields (chapter 04)
- chomp ↗, sort ↗, sprintf ↗.
- Unicode::Collate ↗ and Unicode::Collate::Locale ↗.
- Text::ParseWords ↗ and Scalar::Util ↗ (
looks_like_number). - Text::CSV ↗ — on CPAN, not in core; the parser the CSV lesson recommends.
The Unicode standards underneath
- UAX #29, Text Segmentation ↗ — what
\Xcounts. - UAX #15, Normalization Forms ↗ — NFC and NFD.
- UTS #10, the Collation Algorithm ↗ — what
Unicode::Collateimplements.
A book¶
- Perl One-Liners: 130 Programs That Get Things Done ↗, Peteris Krumins (No Starch Press, 2013). A catalogue of one-liners by task. Chapter 01 here is the mechanism under every one of them — read it first, and the book's programs stop being incantations.
Sibling libraries¶
Same house style, same answer-key contract:
- Encodings ↗ — bits, bytes, code points and UTF-8 from the bottom up. Several of its pages already measure Perl: A code point is not a character ↗ counts graphemes with Perl's
\X,runeis anint32↗ has anEncode::decodecolumn, The table has a version ↗ compares perl 5.42's Unicode tables with 5.34's, and "Handles Unicode" is four questions ↗ has a Perl row. - Python ↗ —
strandbytes. Its What ends a line ↗ compares Python's line splitting with Perl's$/and\R. - Java text ↗ — UTF-16, locales, and a
splitcopied from Perl's. - Ruby text ↗ — the language that kept Perl's
-n,-p,-a,-F,-i,splitandpack, and labels every string with an encoding where Perl keeps one flag. - C ↗ — text as bytes and a convention, and ICU for everything beyond.
- Rust ↗ — its Strings chapter ↗ is the same subject with the encoding enforced by the type.
Tools worth having¶
perldoc— the documentation above, offline.perldoc -f NAMEfor a function,perldoc -v '$/'for a variable.perl -MO=Deparse— what your switches compiled to. Chapter 01 uses it on every one.perl -CSDA -Mutf8— the switches that make a one-liner decode its input, its arguments and its own source.- Perl::Critic and Perl::Tidy, from CPAN — a linter and a formatter. Neither ships with perl.