Perl 5.34 makes more language choices explicit
Native exception handling arrives as an experiment, while octal notation and controls for older syntax make program intent more visible.
Perl 5.34 lets a program say more about which parts of the language it intends to use. Its most visible addition is experimental try and catch, but two less conspicuous controls also matter. Programs can now disable bareword filehandles and multidimensional hash-key emulation through named features. The release notes describe these alongside an explicit 0o prefix for octal literals. Together they give maintainers more ways to express intent without assuming that older syntax has disappeared.
These changes address different kinds of ambiguity. Exception syntax specifies how protected code participates in function control flow. An octal prefix identifies a number's base. Disabling an older feature turns particular accidental syntax into a compilation error. None requires every existing program to adopt the same style, and the new controls preserve their older behaviours by default.
I still choose Perl for small text-processing jobs because its grammar makes that work concise. The cost is that a reader needs to know which language rules a compact expression invokes. Explicit feature declarations are useful when they reduce that uncertainty without forcing unrelated code to change.
Exception handling belongs to control flow
The 5.34 syntax manual gives try a particular relationship to its containing function. A return in its protected block returns from the function. With a block eval, the same operation returns from the eval block. This difference has consequences for functions with early exits inside protected work.
use feature 'try';
no warnings 'experimental::try';
sub checked_count {
my ($count) = @_;
try {
die "negative count" if $count < 0;
return $count;
}
catch ($error) {
warn $error;
return undef;
}
}
Here both returns leave checked_count. The handler receives its exception through a lexical variable declared by the parentheses after catch. It does not need a separate my. When protected code completes normally, the handler does not execute. If the handler completes normally too, execution continues at the statement after the construct.
Those semantics also explain a detail relevant to stack inspection. The manual says that caller does not report try blocks. It can report subroutine calls and eval blocks because those change the target of return. A try block does not introduce that kind of return boundary. The behaviour is consistent with treating it as control-flow syntax in the surrounding function.
A protected expression can also supply a value through the last evaluated expression when the construct ends a function or a do block. An explicit return still exits the containing function. A reader therefore needs to distinguish the result of a block from a transfer of control out of the function. Native syntax makes that distinction documented, but it does not eliminate it.
The feature remains experimental in 5.34. Enabling try produces the experimental::try warning unless the program disables that category. The example disables only that warning so the demonstration can report its intentional exception without also reporting feature use. This declaration is an acknowledgement of an experiment, not evidence that the syntax has the same stability commitment as the interpreter release.
Older syntax can be refused locally
The feature documentation in the release explains the new multidimensional switch. Perl's older multidimensional-array emulation turns a hash subscript with comma-separated values into a joined string key. In particular, $record{$x, $y} uses the value of $; to join the components. It does not construct a nested data structure.
use strict;
use warnings;
no feature 'multidimensional';
my %record;
$record{left}{right} = 7;
Disabling the feature makes the comma-subscript form a compilation error. Code using nested hash access can remain explicit about that choice. This helps when a maintainer wants an accidental comma in a hash lookup to fail instead of selecting a compound key according to a less familiar rule. The feature stays enabled by default, preserving programs that deliberately use the older emulation.
The bareword_filehandles switch follows the same general compatibility approach. It can disable bareword filehandles for builtin operations, while predefined handles remain available. The documented exceptions include STDIN, STDOUT, and STDERR, as well as handles used by standard input-processing machinery. A program can therefore restrict its own handle declarations without losing access to those builtins.
These controls differ from removing syntax globally. A maintainer opts a lexical scope into a narrower set of accepted forms. Existing source can continue to compile under the default setting. That tradeoff makes the feature useful for code being revised incrementally, since a module can state its rules without making an assertion about every dependency it loads.
I prefer a compiler error when a program has explicitly rejected an older interpretation. Perl's flexibility is useful for text work, but a maintained module benefits from stating which interpretations its author expects. The new switches make that decision visible in source where a reviewer can find it.
Octal gets an unmistakable prefix
The release introduces literals such as 0o123_456, parallel to the existing hexadecimal and binary prefixes. The builtin oct also accepts the new spelling. This is a small syntax change with a specific reading benefit. The base can be identified through a letter in the prefix instead of relying only on a leading zero.
use strict;
use warnings;
my $mode = 0o640;
my $parsed_mode = oct('0o640');
Both forms name the same octal value. The literal is appropriate when the value is part of the program, while oct converts an external textual representation. The addition does not mean that every string containing digits is interpreted as octal or that input validation has become unnecessary. It supplies a clearer spelling for an operation that the code already intends.
The regex grammar receives comparable local changes. Quantifiers can omit a lower bound, as in {,3}. Blanks can appear adjacent to braces in the documented escape forms, and spaces or tabs can surround the comma in a braced quantifier. The release explicitly says these allowances do not require /x. Reading a pattern now needs to account for that grammar rather than assuming spacing inside these constructs implies an extended-mode declaration.
For a maintainer, the distinction is between whitespace that separates grammar components and characters the pattern matches. The release expands where the former is permitted. It does not make arbitrary spacing outside those documented positions insignificant. That limited change can improve readability of a character escape or a bound without changing an entire pattern's whitespace policy.
Correctness work accompanies the syntax
The same release repairs environment-key assignment when a Perl string has an upgraded internal representation. Keys now follow the conversion previously used for values. Perl first attempts to downgrade the string and, if that fails, warns and uses UTF-8. The notes explicitly identify values as having used this policy since 5.18. This removes a dependency on the key scalar's internal buffer representation.
Several System V IPC operations receive related repairs. Input structures passed through strings are downgraded to bytes for the specified operations. Output operations reset the UTF-8 flag where appropriate. The notes explain that leaving an input string upgraded could pass a corrupted structure to the underlying function. These fixes concern representation at a binary interface, which is a different problem from adding Unicode-aware text behaviour.
The regex compiler leak tracked in issue 18604 also ships in this stable release. Its presence under performance improvements does not imply a universal matching-speed improvement. The identified benefit is correcting retained compiler allocations. Similarly, a new configure probe detects problematic libc number-formatting routines so Perl can use sprintf instead. Both are specific implementation repairs with effects determined by the affected workload or platform.
There are deliberate compatibility details for extension authors too. The release removes the PERL_GLOBAL_STRUCT build option and retains dVAR as a no-op outside the core. It adds av_count as a clearly named array-count API. These changes show why reviewing an interpreter upgrade involves the extension interface as well as application syntax. A program can use none of the new notation while still depending on compiled code affected by interpreter internals.
The release also ships the new perlgov document and updates development policy to reflect its adoption. The council becomes the fallback contact for security issues. Those documentation changes define who takes responsibility when normal reporting needs another route. They are part of the maintained interpreter distribution, so an installed manual can explain project authority alongside the APIs and syntax it documents.
Perl 5.34 therefore offers several independent adoption decisions. Existing code receives correctness fixes without enabling experimental exception handling. A revised module can disable a legacy syntax while retaining the default behaviour elsewhere. Source that opts into try needs to account for its documented return semantics and warning category. The release keeps those decisions separate through declarations that can be read in the program itself.