Formats

[This is a special Blast from the Past post where I republish Randal Schwartz’s original “Formats” chapter from the first edition of Learning Perl. I’ve really liked this output feature which has mostly been left behind by the online world that doesn’t do physical pages. It hasn’t been worth the 10 or so pages it would take up in the print version of the book, so I present it here mostly as it appeared—historical warts and all.]

What Is a Format?

Perl stands, among other things, for “Practical Extraction and Report Language.” It’s time to learn about that “…Report language” business. Continue reading “Formats”

The vertical tab now matches \s

Perl 5.18 added vertical tab (or LINE TABULATION in the UCS) to the characters that match the \s character class shortcut. It’s the one exception that made that shortcut different from the POSIX definition of whitespace. For the details, see my posts in The Effective Perler: The vertical tab is part of \s in Perl 5.18. Continue reading “The vertical tab now matches \s”

Why we teach the subroutine ampersand

In Learning Perl, we tell readers to use the & to prefix subroutine calls when we introduce the idea of reusable code. This doesn’t sit well with some programmers because it’s not how the experienced programmers work. The & does some magic, which we don’t mention in the book, and it’s a bit crufty for the Perl 5 programmer. Continue reading “Why we teach the subroutine ampersand”