The most significant features introduced for recent versions of the Perl
scripting language.
Core security support is provided for 3 years, so typical users should run at least 5.38.
Stable distributions such as Debian 11 maintain 5.32+.
Enterprise platforms retain versions up to 5.14.
5.42 2025-07-03: latest stable release
use source::encoding 'ascii'
disallow non-ASCII in following program code, catching Unicode without appropriate use utf8(bundled)
:writer
field attribute automatically create writer accessors, analogous to :reader(feature)
any, all
operators to test value existence, basically grep with boolean results; even faster than List::Util synonyms {any {$_ == 3} 1..5} (feature, experimental)
my method
lexical visibility like my sub for privatemethod subroutines; can be called by a new ->& operator
Unicode
v16.0
5.40 2024-06-09: active core support
use v5.40
import builtin functions and enable the try feature
__CLASS__
keyword to reference to the current class name, similar to __PACKAGE__(feature)
:reader
attribute for field variables to create corresponding accessor methods (feature)
^^
higher precedence logical xor operator, as || is to or (variant ^^= added in v5.42)
builtin::inf, builtin::nan
constants equivalent to special floating point values infinity and Not a Number
use Test2::Suite
comprehensive set of test tools for writing unit tests, providing a drop in replacement to Test::More
5.38 2023-07-02: official security patches
use feature "module_true"
packages implicitly return true, enabled along with no feature "bareword_filehandles"(bundled)
sub ($var ||= default)
assign values when false (or undefined on //=) instead of omitted
/(*{ … })/
optimistic eval: (?{ … }) with regex optimisations enabled
class
define object classes: packages with field variables and method subroutines (feature, experimental)
${^LAST_SUCCESSFUL_PATTERN}
explicit variable to access the previous match as in s//…/
%{^HOOK}
perform tasks require__before and require__after when calling require
namespace for interpreter functions, such as weaken and blessed from Scalar::Util, ceil/floor from POSIX, and trim like String::Util(experimental until 5.40 then bundled)
is_bool(!0)
distinguish scalar variable types (by builtin functions) for data interoperability
for my ($k, $v) (%hash)
iterate over multiple values at a time (including builtin::indexed for arrays) (feature, experimental until 5.40)
defer {}
queue code to be executed when going out of scope (feature, experimental)
try {} finally {}
run code at the end of a try construct regardless of failure (feature, experimental)
q«…»
unicode delimiters for quoting operators (experimental)
sub ($var) {!pop}
signatured subs are stable, but mixing with the arguments array @_ remains experimental (feature, experimental)
$SIG{FPE}
floating-point exceptions no longer deferred but delivered immediately like other signals
perl -g
disable input record separator (slurp mode), alias for -0777
Unicode
v14.0
5.34 2021-05-20
try {} catch
exception handling similar to eval blocks (feature, experimental until 5.40 then bundled)
/{,n}/
empty lower bound quantifier is accepted as shorthand for 0
\x{ … }
insignificant space within curly braces, also for \b{}, \g{}, \k{}, \N{}, \o{} as well as /{m,n}/ quantifiers
0o0
octal prefix 0o alternative to 0… and oct
re::optimization(qr//)
debug regular expression optimization information discovered at compile time
no feature …
disable discouraged practices of multidimensional and bareword_filehandles array emulation (bundled in 5.36 and 5.38)
5.32 2020-06-20: still maintained by common vendors
isa
infix operator to check class instance (feature, experimental until 5.36 then bundled)
$min < $_ <= $max
chained comparison repeats inner part as $min < $_ and $_ <= $max
/\p{Name=$var}/
match Unicode Name property like \N{} but with interpolation and subpatterns
open F, '+>>', undef
respect append mode on temporary files with mixed access
no feature 'indirect'
disable indirect object notation such as new Class instead of Class->new(bundled in 5.36)
streamzip
program distributed with core IO::Compress::Base to compress stdin into a zip container
Unicode
v13.0
5.30 2019-05-22
/(?<=var+)
variable length lookbehind assertions (experimental until 5.36)
m(\p{nv=/.*/})
match unicode properties by regular expressions (experimental)
my $state if 0
workaround for state (deprecated since v5.10!) is now prohibited
qr'\N'
Delimiters must be graphemes; unescaped { illegal; \N in single quotes
Unicode
v12.1
5.28 2018-06-22
delete %hash{…}
hash slices can be deleted with key+value pairs
/(*…)/
alphabetic synonyms for assertions, e.g. (*atomic:…) for (?>…) and (*nlb:…) for (?<!…)(experimental until 5.31.6)
/(*script_run:)/
enforces all characters to be from the same script (experimental until 5.31.6)
state @a
persistent lexical array or hash variables (in addition to scalars)
perl -i -pe die
safe in-place editing: files are replaced only after successful completion
${^SAFE_LOCALES}
locales are thread-safe on supported systems, indicated by this variable
Unicode
v10.0
5.26 2017-05-30
use lib '.'
current directory no longer included in default module search path @INC
<<~EOT
indented here-docs, strips same whitespace before delimiter in each line
@{^CAPTURE}
array of last match's captures, so ${^CAPTURE}[0] is $1
//xx
extended modifier to also ignore whitespace in bracketed character classes
use Test2::V0
generic testing framework to replace Test::* and TAP::*
Unicode
v9.0
5.24 2016-05-09
printf '%.*2$x'
reordered precision arguments
/\b{lb}/
line break boundary type (position suitable for hyphenation)
/faster/
various significant speedups, notably matching fixed substrings, /i on caseless languages, 64-bit arithmetic, scope overhead
Unicode
v8.0
5.22 2015-06-01
\$alias =
aliasing via reference (scoped as of v5.25.3) (experimental)
<<…>>
safe readline ignoring open flags in arguments
/()/n
flag to disable numbered capturing, turning () into (?:)