Perl 5.10 released on Perl’s 20th anniversary
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.
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
Next on my list are the various pattern matching enhancements; in spite of its relative smallness, my favourite one is probably the
\Kescape, 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.
It seems silly to look forward to
say, but Perl is meant to scale down just as well as up, and since
saysimplifies the simplest uses of
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
when. Both were nicked from Perl 6.
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.