perl5200delta (1) Linux Manual Page
NAME
perl5200delta – what is new for perl v5.20.0
DESCRIPTION
This document describes differences between the 5.18.0 release and the 5.20.0 release.
If you are upgrading from an earlier release such as 5.16.0, first read perl5180delta, which describes differences between 5.16.0 and 5.18.0.
Core Enhancements
Experimental Subroutine signatures
Declarative syntax to unwrap argument list into lexical variables. "sub foo ($a,$b) {...}" checks the number of arguments and puts the arguments into lexical variables. Signatures are not equivalent to the existing idiom of "sub foo { my($a,$b) = @_; ... }". Signatures are only available by enabling a non-default feature, and generate warnings about being experimental. The syntactic clash with prototypes is managed by disabling the short prototype syntax when signatures are enabled.
See “Signatures” in perlsub for details.
subs now take a prototype attribute
When declaring or defining a "sub", the prototype can now be specified inside of a "prototype" attribute instead of in parens following the name.
For example, "sub foo($$){}" could be rewritten as "sub foo : prototype($$){}".
More consistent prototype parsing
Multiple semicolons in subroutine prototypes have long been tolerated and treated as a single semicolon. There was one case where this did not happen. A subroutine whose prototype begins with “*” or “;*” can affect whether a bareword is considered a method name or sub call. This now applies also to “;;;*”.
Whitespace has long been allowed inside subroutine prototypes, so "sub( $ $ )" is equivalent to "sub($$)", but until now it was stripped when the subroutine was parsed. Hence, whitespace was not allowed in prototypes set by "Scalar::Util::set_prototype". Now it is permitted, and the parser no longer strips whitespace. This means "prototype &mysub" returns the original prototype, whitespace and all.
rand now uses a consistent random number generator
Previously perl would use a platform specific random number generator, varying between the libc rand(), random() or drand48().
This meant that the quality of perl’s random numbers would vary from platform to platform, from the 15 bits of rand() on Windows to 48-bits on POSIX platforms such as Linux with drand48().
Perl now uses its own internal drand48() implementation on all platforms. This does not make perl’s "rand" cryptographically secure. [perl #115928]
New slice syntax
The new %hash{...} and %array[...] syntax returns a list of key/value (or index/value) pairs. See “Key/Value Hash Slices” in perldata.
Experimental Postfix Dereferencing
When the "postderef" feature is in effect, the following syntactical equivalencies are set up:
$sref->$ *;
#same as ${$sref } #interpolates $aref->@ *;
#same as @{$aref } #interpolates $href->% *;
#same as % {$href } $cref->&*;
#same as &{$cref } $gref->**;
#same as *{$gref } $aref->$ #*;
#same as $ #{$aref } $gref->*{$slot };
#same as *{$gref } {$slot } $aref->@[...];
#same as @$aref[...] #interpolates $href->@{... };
#same as @$href{... } #interpolates $aref->% [...];
#same as % $aref[...] $href->% {... };
#same as % $href
{
...
}
Those marked as interpolating only interpolate if the associated "postderef_qq" feature is also enabled. This feature is experimental and will trigger "experimental::postderef"-category warnings when used, unless they are suppressed.
For more information, consult the Postfix Dereference Syntax section of perlref.
Unicode 6.3 now supported
Perl now supports and is shipped with Unicode 6.3 (though Perl may be recompiled with any previous Unicode release as well). A detailed list of Unicode 6.3 changes is at <http://www.unicode.org/versions/Unicode6.3.0/>.
New \p{Unicode} regular expression pattern property
This is a synonym for "\p{Any}" and matches the set of Unicode-defined code points 0 – 0x10FFFF.
Better 64-bit support
On 64-bit platforms, the internal array functions now use 64-bit offsets, allowing Perl arrays to hold more than 2**31 elements, if you have the memory available.
The regular expression engine now supports strings longer than 2**31 characters. [perl #112790, #116907]
The functions PerlIO_get_bufsiz, PerlIO_get_cnt, PerlIO_set_cnt and PerlIO_set_ptrcnt now have SSize_t, rather than int, return values and parameters.
use locale now works on UTF-8 locales
Until this release, only single-byte locales, such as the ISO 8859 series were supported. Now, the increasingly common multi-byte UTF-8 locales are also supported. A UTF-8 locale is one in which the character set is Unicode and the encoding is UTF-8. The POSIX "LC_CTYPE" category operations (case changing (like "lc()", "
