The first major upgrade to the Perl dynamic language in more than five years was released this week, the Perl Foundation said.
Version 5.10 of the open source language adds language features and improves the Perl interpreter itself. While used in Web application development, Perl also can be found in bioinformatics applications such as gene-sequencing, said Perl representative Andy Lester.
A key feature is a smart match operator, which will compare variables in an array and makes it easier for programmers to perform functions such as finding an element in an array or an element in a hash, Lester said. Also featured is a switch statement capability.
Regular expressions have been made more powerful and programmers can now use named captures in regular expressions rather than counting parentheses for positional captures. Recursive patterns are supported for making many useful constructs especially in parsing.
Also included in version 5.10 is state variables allowing variables to persist between calls to subroutines. User-defined pragmata allows users to write modules to influence the way way Perl behaves. Better error messages are highlighted as well.
The Perl interpreter is faster and has a smaller memory footprint. The installation of Perl can be relocated, which benefits systems administrators and operating system packagers, the foundation said. Source code is more portable as well.
Also featured are a defined-or operator, which relates to how Perl keeps track of true or false statements, and field hashes for inside-out objects, for implementing data-hiding in Perl. Data can be hidden so users cannot modify data in an object.
Perl 5.10 can be downloaded here.