You are viewing the version of this documentation from Perl 5.14.1. View the latest version



perl5137delta - what is new for perl v5.13.7


This document describes differences between the 5.13.6 release and the 5.13.7 release.

If you are upgrading from an earlier release such as 5.13.5, first read perl5136delta, which describes differences between 5.13.5 and 5.13.6.

Core Enhancements

Single term prototype

The + prototype is a special alternative to $ that will act like \[@%] when given a literal array or hash variable, but will otherwise force scalar context on the argument. This is useful for functions which should accept either a literal array or an array reference as the argument:

sub smartpush (+@) {
    my $aref = shift;
    die "Not an array or arrayref" unless ref $aref eq 'ARRAY';
    push @$aref, @_;

When using the + prototype, your function must check that the argument is of an acceptable type.

use re '/flags';

The re pragma now has the ability to turn on regular expression flags till the end of the lexical scope:

use re '/x';
"foo" =~ / (.+) /;  # /x implied

See "'/flags' mode" in re for details.

Statement labels can appear in more places

Statement labels can now occur before any type of statement or declaration, such as package.

use feature "unicode_strings" now applies to more regex matching

Another chunk of the "The "Unicode Bug"" in perlunicode is fixed in this release. Now, regular expressions compiled within the scope of the "unicode_strings" feature (or under the "u" regex modifier (specifiable currently only with infix notation (?u:...) or via use re '/u') will match the same whether or not the target string is encoded in utf8, with regard to [[:posix:]] character classes

Work is underway to add the case sensitive matching to the control of this feature, but was not complete in time for this dot release.

Array and hash container functions accept references

All built-in functions that operate directly on array or hash containers now also accept hard references to arrays or hashes:

| Traditional syntax         | Terse syntax              |
| push @$arrayref, @stuff    | push $arrayref, @stuff    |
| unshift @$arrayref, @stuff | unshift $arrayref, @stuff |
| pop @$arrayref             | pop $arrayref             |
| shift @$arrayref           | shift $arrayref           |
| splice @$arrayref, 0, 2    | splice $arrayref, 0, 2    |
| keys %$hashref             | keys $hashref             |
| keys @$arrayref            | keys $arrayref            |
| values %$hashref           | values $hashref           |
| values @$arrayref          | values $arrayref          |
| ($k,$v) = each %$hashref   | ($k,$v) = each $hashref   |
| ($k,$v) = each @$arrayref  | ($k,$v) = each $arrayref  |

This allows these built-in functions to act on long dereferencing chains or on the return value of subroutines without needing to wrap them in @{} or %{}:

push @{$obj->tags}, $new_tag;  # old way
push $obj->tags,    $new_tag;  # new way

for ( keys %{$hoh->{genres}{artists}} ) {...} # old way 
for ( keys $hoh->{genres}{artists}    ) {...} # new way 

For push, unshift and splice, the reference will auto-vivify if it is not defined, just as if it were wrapped with @{}.

Calling keys or values directly on a reference gives a substantial performance improvement over explicit dereferencing.

For keys, values, each, when overloaded dereferencing is present, the overloaded dereference is used instead of dereferencing the underlying reftype. Warnings are issued about assumptions made in the following three ambiguous cases:

(a) If both %{} and @{} overloading exists, %{} is used
(b) If %{} overloading exists on a blessed arrayref, %{} is used
(c) If @{} overloading exists on a blessed hashref, @{} is used


The /r flag, which was added to s/// in 5.13.2, has been extended to the y/// operator.

It causes it to perform the substitution on a copy of its operand, returning that copy instead of a character count.

New global variable ${^GLOBAL_PHASE}

A new global variable, ${^GLOBAL_PHASE}, has been added to allow introspection of the current phase of the perl interpreter. It's explained in detail in "${^GLOBAL_PHASE}" in perlvar and "BEGIN, UNITCHECK, CHECK, INIT and END" in perlmod.

Unicode Version 6.0 is now supported (mostly)

Perl comes with the Unicode 6.0 data base updated with Corrigendum #8, with one exception noted below. See for details on the new release. Perl does not support any Unicode provisional properties, including the new ones for this release, but their database files are packaged with Perl.

Unicode 6.0 has chosen to use the name BELL for the character at U+1F514, which is a symbol that looks like a bell, and used in Japanese cell phones. This conflicts with the long-standing Perl usage of having BELL mean the ASCII BEL character, U+0007. In Perl 5.14, \N{BELL} will continue to mean U+0007, but its use will generate a deprecated warning message, unless such warnings are turned off. The new name for U+0007 in Perl will be ALERT, which corresponds nicely with the existing shorthand sequence for it, "\a". \N{BEL} will mean U+0007, with no warning given. The character at U+1F514 will not have a name in 5.14, but can be referred to by \N{U+1F514}. The plan is that in Perl 5.16, \N{BELL} will refer to U+1F514, and so all code that uses \N{BELL} should convert by then to using \N{ALERT}, \N{BEL}, or "\a" instead.

Improved support for custom OPs

Custom ops can now be registered with the new custom_op_register C function and the XOP structure. This will make it easier to add new properties of custom ops in the future. Two new properties have been added already, xop_class and xop_peep.

xop_class is one of the OA_*OP constants, and allows B and other introspection mechanisms to work with custom ops that aren't BASEOPs. xop_peep is a pointer to a function that will be called for ops of this type from Perl_rpeep.

See "Custom Operators" in perlguts and "Custom Operators" in perlapi for more detail.

The old PL_custom_op_names/PL_custom_op_descs interface is still supported but discouraged.

Incompatible Changes

Dereferencing typeglobs

If you assign a typeglob to a scalar variable:

$glob = *foo;

the glob that is copied to $glob is marked with a special flag indicating that the glob is just a copy. This allows subsequent assignments to $glob to overwrite the glob. The original glob, however, is immutable.

Many Perl operators did not distinguish between these two types of globs. This would result in strange behaviour in edge cases: untie $scalar would do nothing if the last thing assigned to the scalar was a glob (because it treated it as untie *$scalar, which unties a handle). Assignment to a glob slot (e.g., (*$glob) = \@some_array) would simply assign \@some_array to $glob.

To fix this, the *{} operator (including the *foo and *$foo forms) has been modified to make a new immutable glob if its operand is a glob copy. Various operators that make a distinction between globs and scalars have been modified to treat only immutable globs as globs.

This causes an incompatible change in code that assigns a glob to the return value of *{} when that operator was passed a glob copy. Take the following code, for instance:

$glob = *foo;
*$glob = *bar;

The *$glob on the second line returns a new immutable glob. That new glob is made an alias to *bar. Then it is discarded. So the second assignment has no effect.

It also means that tie $handle will now tie $handle as a scalar, even if it has had a glob assigned to it.

The upside to this incompatible change is that bugs [perl #77496], [perl #77502], [perl #77508], [perl #77688], and [perl #77812], and maybe others, too, have been fixed.

See for even more detail.

Clearing stashes

Stash list assignment %foo:: = () used to make the stash anonymous temporarily while it was being emptied. Consequently, any of its subroutines referenced elsewhere would become anonymous (showing up as "(unknown)" in caller). Now they retain their package names, such that caller will return the original sub name if there is still a reference to its typeglob, or "foo::__ANON__" otherwise [perl #79208].


\N{BELL} is deprecated

This is because Unicode is using that name for a different character. See "Unicode Version 6.0 is now supported (mostly)" for more explanation.

Performance Enhancements

Modules and Pragmata

New Modules and Pragmata

Updated Modules and Pragmata


perlvar reorders the variables and groups them by topic. Each variable introduced after Perl 5.000 notes the first version in which it is available. perlvar also has a new section for deprecated variables to note when they were removed.

New Documentation


New style guide for POD documentation, split mostly from the NOTES section of the pod2man man page.

( This was added to v5.13.6 but was not documented with that release ).

Changes to Existing Documentation


New Diagnostics

Utility Changes



Platform Support

Platform-Specific Notes


Directory handles are now properly cloned when threads are created. In perl 5.13.6, child threads simply stopped inheriting directory handles. In previous versions, threads would share handles, resulting in crashes.

Support for building with Visual C++ 2010 is now underway, but is not yet complete. See README.win32 for more details.


Record-oriented files (record format variable or variable with fixed control) opened for write by the perlio layer will now be line buffered to prevent the introduction of spurious line breaks whenever the perlio buffer fills up.

Internal Changes

Selected Bug Fixes


Randy Kobes, creator of the kobesearch alternative to and contributor/maintainer to several core Perl toolchain modules, passed away on September 18, 2010 after a battle with lung cancer. His contributions to the Perl community will be missed.


Perl 5.13.7 represents approximately one month of development since Perl 5.13.6 and contains 73100 lines of changes across 518 files from 39 authors and committers:

Abhijit Menon-Sen, Abigail, Ben Morrow, Chas. J. Owens IV, Chris 'BinGOs' Williams, Craig A. Berry, David Golden, David Mitchell, Father Chrysostomos, Fingle Nark, Florian Ragwitz, George Greer, Grant McLean, H.Merijn Brand, Ian Goodacre, Jan Dubois, Jerry D. Hedden, Jesse Vincent, Karl Williamson, Lubomir Rintel, Marty Pauley, Moritz Lenz, Nicholas Clark, Nicolas Kaiser, Niko Tyni, Peter John Acklam, Rafael Garcia-Suarez, Shlomi Fish, Steffen Mueller, Steve Hay, Tatsuhiko Miyagawa, Tim Bunce, Todd Rinaldo, Tom Christiansen, Tom Hukins, Tony Cook, Yves Orton, Zefram and brian d foy

Many of the changes included in this version originated in the CPAN modules included in Perl's core. We're grateful to the entire CPAN community for helping Perl to flourish.

Reporting Bugs

If you find what you think is a bug, you might check the articles recently posted to the comp.lang.perl.misc newsgroup and the perl bug database at . There may also be information at , the Perl Home Page.

If you believe you have an unreported bug, please run the perlbug program included with your release. Be sure to trim your bug down to a tiny but sufficient test case. Your bug report, along with the output of perl -V, will be sent off to to be analysed by the Perl porting team.

If the bug you are reporting has security implications, which make it inappropriate to send to a publicly archived mailing list, then please send it to This points to a closed subscription unarchived mailing list, which includes all the core committers, who be able to help assess the impact of issues, figure out a resolution, and help co-ordinate the release of patches to mitigate or fix the problem across all platforms on which Perl is supported. Please only use this address for security issues in the Perl core, not for modules independently distributed on CPAN.


The Changes file for an explanation of how to view exhaustive details on what changed.

The INSTALL file for how to build Perl.

The README file for general stuff.

The Artistic and Copying files for copyright information.