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. » Read more…

Learning Perl Challenge: March Madness

Warren Buffet’s Berkshire Hathway is insuring Quicken Loans’ prize of $1 Billion dollars to someone who picks a perfect March Madness bracket and 20 prizes of $100,000 to the closet brackets. The rules won’t be enumerated until March 3, but so far they haven’t outlawed Garciaparra-ing by pulling a Nandor. If you want people to sit up and notice Perl, winning this contest with a Perl program will get you all the fame you want. You’ll be any job you want, but with $500 million (the present day value single payout), you won’t have to take it. » Read more…

Captures with quantifiers match the last captured substring

A student in my Learning Perl class asked about what shows up in a capture when you apply a quantifier to that group. The great thing about computer programming is that you can just try it to find out: » Read more…

Ruling the world with Perl and Excel

In Chapter 12 of Learning Perl, we have an exercise for people to practice using the file test operators. Our answer, which can only use the stuff we’ve covered in the book to that point, is simple: » Read more…

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. » Read more…

7ads6x98y