Perl 5.10 released on Perl’s 20th anniversary

Wednesday, Dec 19, 2007, 06:52 (updated Tuesday, Jan 1, 2008, 06:10)

The Perl community is kind of insular; on weblogs, you’re much more likely to hear of Ruby and Python, despite the persistent popularity of Perl and its ever vibrant community. So I thought I’d lend my favourite language more of a voice and post about this latest big news.

Exactly 20 years after December 18, 1987, the day of Perl 1’s release, we get Perl 5.10. That’s not just a bugfix release – there’s tons of new stuff. Features I personally can’t wait to use:

  1. Looming tall above everything else in the list is the new Hash::Util::FieldHash core module. This finally allows you to write classes in Perl with proper encapsulation of instance variables and compile-time checking of typos in them. Perl 5 OO finally departs from the dark ages of global-in-disguise, implicitly-declared-at-first-use instance variables (catching up to where lexically scoped variables have been since Perl 5.0.0 in 1994).

    I don’t really know much about Python. I only stole its object system for Perl 5. I have since repented.Larry Wall

  2. Next on my list are the various pattern matching enhancements; in spite of its relative smallness, my favourite one is probably the \K escape, which I’ve long enjoyed using in Vim (where it is known as \zs) for how it can simplify a lot of substitutions. Next are named captures. Really, though, all of the new features are very cool.

  3. It seems silly to look forward to say, but Perl is meant to scale down just as well as up, and since say simplifies the simplest uses of print it’s going to make one-liners just that smidgen easier.

  4. The smart match operator, which makes many kinds of comparisons on compound data structures much more concise, and also serves as the basis for the new switch-like construct (one of the most requested features for Perl, ever), called given/when. Both were nicked from Perl 6.

  5. Oh yeah, the new “_” prototype obsoletes a module I wrote and put on CPAN. Deleting code is the greatest pleasure in the life of a programmer.

Oh, and if you’re on Windows (my condolences), keep an eye on the Strawberry Perl homepage, where a version of Perl 5.10 bundled with a C compiler and everything else required to install modules directly from CPAN will soon be available.

Update: there’s a great condensed outline of everything new of note in 5.10 on Perl Monks.