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…

The evolution of character class shortcuts

Character class shortcuts used to be easy because ASCII was easy. Either of those were easy if ASCII was what you wanted, but quite limiting otherwise. Perl v5.6 introduced Unicode support and the world started to change.


A good programmer is always trying to eliminate ambiguity. Their code should work the same way everywhere, but character class shortcuts can’t guarantee that anymore. I wrote about these a bit in Know your character classes for The Effective Perler.

» 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…

Looking for Learning Perl reviewers

[I’ve found enough reviewers and am not accepting more. If you’ve been a reviewer for a past Learning Perl, however, you can volunteer again. If you’re interested in doing this sort of work, pay attention to any of my blogs since I’m likely to start revising another book when I finish this one.]

I’ve got Learning Perl, 7th Edition building on O’Reilly’s Atlas system. That means I can start showing it to other people for comments and reviews. If you think that you’d like to be one of those people, send me an email (the first step being the sort who can find my email address). » Read more…

We’re starting Learning Perl, 7th edition

The holiday season tends to find me writing Perl books. This time it’s the next edition of Learning Perl, last published for Perl v5.14. This time we’re targeting v5.24, and there are lots of exciting new features that we want to tell the new Perl users.


We can’t make promises at the beginning of the book, but here’s the rough idea so far:

  • Goodbye, smart match. We gave it a chapter, but now it’s experimental .
  • But, subroutine signatures! People are going to love those.
  • So, an appendix on experimental features. Or maybe a chapter. Mostly on how to enable them.
  • the /r modifier for s///
  • Removing most of the stuff that Perl has discarded without abandoning people using older versions.
  • Key-value slices, and slices, and splice.
  • The double diamond operator <<>>.
  • New Unicode regex stuff

I’ve done this too many times to promise a release date either, but late summer wouldn’t be a bad guess. When I get the current version into something editable and fixed up, I’ll start putting out review versions somehow. I don’t know how that will work yet.