1. Perl
  2. Version information
  3. here

Perl 5.20 released - support for ipv6, new subroutine syntax, new slice notation, Unicode 6.3 support, etc.

Perl 5.20 has been released. There are quite a lot this time. I will pick it up and introduce it.

Features added/changed in Perl 5.20

IO::Socket::IP becomes core module

IO::Socket::IP is now the core module in Perl 5.20. Perl used IO::Socket::INET when using sockets, but it seems to be a module that can be used with the same interface, including support for ipv6.

CGI, Module::Build will be deprecated

The CGI module, which has been a core module for many years, will be removed from the core in the next release. .. Also, Module::Build, which can do make equivalents in pure Perl, will be out of the core in the next release.

Starting with the next release of Perl 5.22, the CGI module will need to be installed from cpan if needed. As for Module::Build, it will be installed automatically if necessary, so there seems to be no problem.

Subroutine signature

Subroutine signatures have been added experimentally. This is a function that can be used with ordinary arguments in Perl. It is still in the experimental stage, so you will be warned if you use it.

use feature 'signatures';

sub foo ($x, $y) {
  ...
}

See Perl 5.20 experimentally introduces subroutine signatures for more information.

Along with this, when writing a conventional prototype, the prototype attribute can be used.

sub foo: prototype ($$) {
  ...
}

This feature is so good that I hope the warning goes away early on.

New notation for array slice and hash slice

Array slices and hash slice can now be written in a new notation.

use feature 'postderef';

# Array slice
my ($title, $author) = $array_ref->@[0, 1];

# Hash slice
my ($title, $author) = $hash_ref->@{'title', 'author'};

The notation "$aref->@*" has also been added, but I personally thought that the notation "$aref->@*" would not be necessary. If you want to take the whole thing, it would be enough if you could do "@$aref".

Slice notation is easy to understand and convenient.

New slices "index/value slice" and "key/value slice" and

An "index/value slice" has been added that allows you to get an "index-value" pair when you specify an index in an array.

my @array = (1, 3, 5);

# (0 => 1, 1 => 3)
my %index_values = %array [0, 1];

A "key/value slice" has been added that allows you to get a "key/value" pair by specifying a key in the hash.

my %hash = (a => 1, b => 2, c => 3);

# (a => 1, b => 2);
my %key_values = %hash {'a', 'b'};

It's convenient, but it's a little difficult to read unless you get used to it.

Improved string copy performance

Copy-on-write now works when copying strings. If you just refer to it, even large strings will copy very quickly and you won't have to use a scalar reference.

ithread has been deprecated

ithread has been officially deprecated. The ithread looks like a fast, lightweight thread for multitasking, but that's not the case, it's very hard to use and heavy.

Historically, it's probably implemented to emulate forks on Windows, but it's marked as deprecated because it was so misleading and difficult for users to use. I think it's a good thing.

Other minor changes

  • Supports Unicode 6.3
  • find2perl, s2p, a2p have been deprecated. If you want to use it from the next release of Perl 5.22, you need to install it from cpan.

Related Informatrion