First release of perl in five years arrives
Dec 21, 2007 — by LinuxDevices Staff — from the LinuxDevices Archive — viewsJust in time for Christmas, there's a new version of perl, the first in over five years. The first update since 2002 to the “practical extraction and report language,” perl 5.10 adds both new language features and an improved perl interpreter, according to community site Perl Buzz.
Perl is a dynamic scripting language widely used in everything from Linux system utilities to web servers to full-blown graphical enterprise applications. During its 20-year history, it gained massive popularity by assimilating the syntax from many predecessors, making it really easy to use for anyone already versed in sed, awk, grep, csh, C/C++, Lisp, and so on.
Perl's syntactical flexibility sometimes makes perl scripts challenging to read, however, and languages like python with rigid syntax structure have arguably gained ground in recent times over perl, for applications that are developed collaboratively. Additionally, scripting languages specially-made for use on the Web, like PHP and Ruby, have eroded some of perl's once formidable share of the dynamic web server scripting scene.
What's new?
First among new features is a “smart match operator” that appears aimed at making perl's relatively strong typing easier to work with. The “~~” operator apparently guesses the type from context, allowing lazy comparisons like if ( $needle ~~ @haystack ) ...
.
Of this new feature, Perl Buzz comments, “The result is that all comparisons now just Do The Right Thing, a hallmark of Perl programming.”
Other new language features include:
- A switch statement said to go “far beyond” those found in C, C++ or Java
- Regex improvements:
- “Named captures” aimed at reducing the need for positional captures
- Recursive patterns said to be useful in parsing
- State variables that persist between subroutine calls
- User defined pragmata
- A “defined-or” operator
- Field hashes for inside-out objects
- Better error messages
Perl is an interpreted, rather than a compiled language. Thus, the human-readable code is interpreted on the fly by a perl interpreter.
With the 5.10 release, the interpreter gains speed, while shedding weight, Perl Buzz claims. Other interpreter improvements include:
- Relocatable installation, for more filesystem flexibility
- Source code is more portable
- Many small bug fixes
A complete changelog can be found here. Also available are presentation slides by perl guru Ricardo Signes. The Perl Buzz release notes can be found here.
This article was originally published on LinuxDevices.com and has been donated to the open source community by QuinStreet Inc. Please visit LinuxToday.com for up-to-date news and articles about Linux and open source.