What’s new: Experimental features

Learning Perl, Seventh Edition (now available for pre-order) adds an appendix on Perl’s experimental features. This way, we can introduce such a feature in the chapters without explaining the dance of pragmas and proper versions each time. People who don’t want to use those features can easily skip over those bits in the main text. » Read more…

Pre-order Learning Perl, 7th Edition

Learning Perl, 7th Edition is now available for pre-order. Amazon.com thinks they’ll have it by the end of September. Now that you can buy the book, I’ll start posting about what’s different in the new edition. We cover up to Perl v5.24, and I think we snuck in one note about v5.26.

If you don’t like Amazon.com (whose link gives us a little kickback without costing you more), you can also pre-order directly from O’Reilly.

Watch regexes with Regexp::Debugger

Wouldn’t it be great if books had embedded videos? That would make programming textbooks so much easier.

We have to give some hints about how regexes work in the first regex chapter in Learning Perl. It’s hard to describe something like greedy matching and backtracking with only words. It seems like it should be simple to describe, but you are probably like me: you think that because you already understand those concepts. » Read more…

The locale’s thousands separator

Perl can use the thousands separator appropriate for your locale, as well as the appropriate decimal separator. The Number::Format from CPAN can do all sorts of interesting localizations, but POSIX can do it.

I debated offering an example in Learning Perl (7th Edition), but POSIX‘s localeconv function returns a hash reference. And, although I’ve added an appendix covering experimental features, I didn’t want to go through enough Perl to explain slices and postfix dereferencing. » Read more…

DOS pattern matching, in Perl

Perl’s file globbing uses the FreeBSD-style globbing, but it works mostly everywhere since Perl handles it internally through the File::Glob module. I’m working on the “Directory Operations” chapter for Learning Perl, 7th edition, where we cover glob. I’m trying to make the book more Windows friendly so I’ve been considering how this stuff translates.

I ran across Raymond Chen’s “How did wildcards work in MS-DOS?”. He lays out the steps for turning what we think of as a pattern (such as “*.txt”) into the CP/M-style pattern that MS-DOS used. He shows how to convert the glob pattern to primitive pattern. » Read more…