Perl 5.34.0 Released - What's New?
Written by Nikos Vaggalis   
Tuesday, 01 June 2021

We look at the first stable release of version 34 of Perl 5. It's the culmination of around 11 months of development and represents 280,000 lines of changes across 2,100 files from 78 authors.

Sadly this is going to be the final release under Sawyer X's supervision as he is stepping down from the position of the Pumpking due to being bullied for suggesting that the language has got cruft that must be cleaned.

That aside, what news does this release bring?

First of all a new way of handling exceptions with the try/catch construct which brings Perl up to par with many of the other programming language who use it as the default mechanism.This means that now instead of the classic way of checking for exceptions:

eval { a_function() };
if ($@) {
    warn "An error occurred: [$@]\n";
} 

we switch to:

try {
    a_function();
}
catch ($e) {
    warn "An error occurred: $e";
}

There were third party try/catch modules on CPAN, like Syntax::Keyword::Try, which extended Perl with that feature, but now it seems that it's finding its way into the core. However, the feature is still experimental and has to be enabled by issuing:

use feature 'try';

The default modules that Perl is using have also been updated to  newer versions. As such Archive::Tar has been upgraded from version 2.36 to 2.38, autodie from version 2.32 to 2.34, Data::Dumper from version 2.174 to 2.179 and Encode from version 3.06 to 3.08, etc.

It is important to note that the versions of the modules don't correlate to Perl's version. For example, the latest version 2.8 of Archive::Tar was released on 25/06/2020 while Perl 5.34 arrived on May 24, 2021; it's just 5.34 has been upgraded to incorporate the modules' latest versions, whenever they were released.

A couple of minor changes include :

 

  • that now an empty lower bound is accepted for regular expression quantifiers, like {,3} as in qr/{,n}/
  • that blanks are freely allowed within, but adjacent to, curly braces, something that means that \x{ FFFC } is now legal
  • that a new octal syntax, 0oddddd, is introduced.

 

Documentation has been also update -.perlsyn, perlfaq, perldiag, perldebguts, perlapi and the rest.

There also was breaking backwards compatibility. That is,the emulation of multidimensional arrays with hashes has been turned off by default and instead moved into a feature. As such you have to explicitly call it with use feature 'multidimensional'

The same goes for enabling bareword filehandles.They are now taken off from the default and instead are enabled by issuing use feature 'bareword_filehandles'.

Other than that, the team was frugal with the breaking of backwards compatibility. Despite the cases above, thoughts of more invasive changes, such as enabling use strict by default, were quickly rescinded. Maybe it was deemed wise to leave those to Perl 7.

Finally, there were the usual bug fixes and changes to diagnostics and warnings.

The Perl distribution can be downloaded from https://metacpan.org/release/XSAWYERX/perl-5.34.0 , while a detailed summary of all changes can be found on the version's perldelta document.

More Information

Perl 5.34.0 distribution on metacpan

perldelta

Related Articles

Now Perl 6 Is Raku, Perl 5 Can Be 7

 

Last Updated ( Tuesday, 01 June 2021 )