Perl 5.36 Released - What's New?
Written by Nikos Vaggalis   
Monday, 13 June 2022

Perl 5.36 was recently released and comes with many great features. It's a prelude to Perl 7 but might prove more than that since 7's future is still uncertain.

First of all borrowing from Perl's 7 philosophy, 5.36 comes with modern and sensible defaults. That is, use 5.36; loads pragmas and features already being advised for years to programmers writing in Perl, like turning strict and warnings on, use 5.010 or importing Modern::Perl, which are now going to be set by default when you start writing a new program under this version. 

According to Ricardo Signes, that directive in place does the following:

  • turns on strict (use strict)
  • turns on warnings (use warnings)
  • turns on all the same new features as v5.34…
    …except switch, which is finally left out!
  • turns off indirect object syntax
  • turns off multidimensional array emulation
  • turns on subroutine signatures

However that's not the whole story as use 5.36 imports more defaults. More details come from the Perl Steering Committee which says that that one line is equivalent to:

require v5.36;
use strict;
use warnings;
use feature 'say';
use feature 'state';
use feature 'current_sub';
use feature 'fc';
use feature 'lexical_subs';
use feature 'signatures';
use feature 'isa';
use feature 'bareword_filehandles';
use feature 'bitwise';
use feature 'evalbytes';
use feature 'postderef_qq';
use feature 'unicode_eval';
use feature 'unicode_strings';
no feature 'indirect';
no feature 'multidimensional';

That is what is meant in part by "turns on all the same new features as v5.34".

Such a feature introduced in v5.34 finds its way into v5.36 too but becomes more evolved.That is, the new way of handling exceptions under the try/catch construct which brings Perl up to par with many of the other programming language which use it as their 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 {
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';

In 5.36 additionally it gets a finally block too:

try {

catch ($e) {

finally {


As already said in the introduction, the important feature of subroutine signatures turns from experimental to default after many iterations. It is now considered a stable language feature and no longer prints a warning.

use v5.36;

sub add ($x, $y) {
 return $x + $y;

Newly and experimentally introduced is the builtin pragma, which imports several utility functions which were always present in the interpreter and now can be called at any time by their fully-qualified names.

use builtin qw(
true false is_bool
weaken unweaken is_weak
blessed refaddr reftype
created_as_string created_as_number
ceil floor

These builtin imports extend functionality. For instance:

builtin::true, builtin::false, builtin::is_bool.

which as Perl doesn't have strict typing of Booleans, these values will be known to have been created as Booleans, for example is_bool will tell you whether a value was known to have been created as a Boolean.

Under the same perspective:

builtin::created_as_number and builtin::created_as_string

returns a Boolean identifying whether the argument value was originally created as a number or a string.

These two functions are intended to be used by data serialisation modules such as JSON encoders or similar situations, where language interoperability concerns require making a distinction between values that are fundamentally stringlike versus numberlike in nature.

The convenient functionality of iterating over multiple values at a time comes in experimentally. You can now iterate over multiple values at a time by specifying a list of lexicals within parentheses. For example,

for my ($key, $value) (%hash) { ... }
for my ($left, $right, $gripping) (@moties) { ... }

Prior to Perl v5.36, attempting to specify a list after for my was a syntax error.

As with try/catch, another feature found in other languages like Go, finds its way in. That is, blocks prefixed by the defer modifier provide a section of code which runs at a later time during scope exit.

use feature 'defer';

say "This happens first";
defer { say "This happens last"; }

say "And this happens inbetween";

A new command-line flag, -g, is available as a simpler alias for -0777.In essence it undefines the input record separator ($/) and thus enables the slurp mode - that is, it causes Perl to read whole files at once instead of line by line.

Of course, as Perl is always at the forefront of Unicode support, v5.36 comes with Unicode 14.0.

As is always the case, each release also features deprecations, performance enhancements and updates to modules and pragmata. So the default modules that Perl is using have also been updated to newer versions. As such Archive::Tar has been upgraded from version 2.38 to 2.40, Data::Dumper from version 2.179 to 2.184, Scalar::Util from version 1.55 to 1.62, 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.40 of Archive::Tar was released on July 27, 2021 while Perl 5.36 arrived on May 28, 2022; it's just 5.36 has been upgraded to incorporate the modules' latest versions, whenever they were released.

For more details and all the new introductions as well changes, check the perl delta of the version.

Also, 5.36 is one of the last versions incorporating Perl's default OO mechanism. Future versions will likely incorporate the post-modern Corina OO system, spearheaded by Ovid. According to him:

If you’re waiting for the Corinna OOP project to land in the Perl core, you’ll have to wait. Paul Evans will start working on the implementation after Perl version 5.36 is released. However, it’s a lot of work and it’s not clear that if it will be ready by 5.38 and even then, it will be experimental. You’ve a couple of years to wait.

With that said, you think that it's all over? It is not! With the ink on the release still not dry, the first development release of the v5.37 series became available! Following its perl delta, we find Perl 5.37.0 represents approximately 2 hours of development since Perl 5.36.0 and contains approximately 3,600 lines of changes across 37 files from 1 author. Excluding auto-generated files, documentation and release tools, there were approximately 61 lines of changes to 6 .pm, .t, .c and .h files.

So yes,you haven't missed out on anything important by not following tracks to v5.37. That won't be the case though  when v5.38 arrives. Till then enjoy 5.36.


More Information

Perl 5.36 delta

Related Articles

Perl Turns 34 - A Retrospective

RegexLearn And Other RegEx Resources

Unicode Version 14 Announced

It Was About Time To Find A Shared Vision Of Perl


To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.


DuckDB 1.0 Released

DuckDB 1.0 has been released following a successful release of the 0.10 version back in February that introduced a version of DuckDB with both forward and backward compatibility for DuckDB's storage f [ ... ]

GitHub Announces 2024 Accelerator Cohort Winners

GitHub has announced the companies chosen to form the next cohort for GitHub Accelerator. Find out about this year's participating projects, all of which focus on AI.

More News

C book



or email your comment to:

Last Updated ( Monday, 13 June 2022 )