- Perl ›
- Version information ›
- here
Perl 5.22 has been released - math related enhancements, method performance improvements, regular expression improvements
The latest version of Perl 5.22 was released on June 1, 2015.
This release has a lot of feature additions.
Performance improvements
The best part about Perl 5.22 is the performance improvements. Improved performance with multi-reference parsing and improved method parsing.
Improved performance of multi - level dereference
Perl's internal parser can now efficiently parse multi-tier dereference. This has improved the performance of multi-tier dereference.
$scores->[0]{math};
Method call and SUPER pseudo - class performance improvement
Method calls and SUPER pseudo-classes are pre-parsed and their information cached. This improves the performance of method calls at runtime.
$obj->method $obj->SUPER::method;
Performance improvement of length function
The length function improves performance by 20%for non-UTF-8 strings.
Array and hash performance improvements
Access to array and hash elements is faster if the key is a constant or a simple variable.
Addition of Perl 5.22 features
Perl 5.22 includes improvements to math-related features.
C99 math functions are now available
Mathematical functions supported by C99 in Perl are now available through the POSIX module.
atanh tgamma
Improved handling of infinity and NaN (non - numeric)
Inf and NaN are now more robustly available.
Improved hexadecimal floating point parsing
Hexadecimal floating point parsing has been improved. It also adds a literal that describes floating point points in hexadecimal.
0x1.23p-4
Now it is possible to represent numbers at the Perl level that are consistent with the machine level.
As you can see, Perl 5.22 has significantly improved math-related features.
Flags that don't use regular parentheses for capture
Perl 5.22 adds a new flag for regular expression that doesn't use regular parentheses for capture. This makes it possible to write complex a regular expression concisely without using the uncaptured parentheses "(? :)".
"hello" =~ /(hi | hello)/n
I'm using parentheses, but I don't capture them. If you want to capture with the n option, do the following:
"hello" =~ /(?-n :( hi | hello))/n; # $1 is "hello" "hello" =~ /(? <greet> hi | hello)/n; # $1 is "hello", $+ {greet} is also "hello"
When writing complex a regular expression, it might be easier to see them in combination with the n option and a named capture.
Unicode 7.0 support
Perl 5.22 now supports Unicode 7.0. Perl supports Unicode very quickly.
Alias through reference
There is a feature called aliases as a feature of Perl, which can now be called at the syntax level. This feature is experimental.
use experimental::refaliasing; my $nums = [1, 2, 3]; my $nums_alias; \$nums_alias = \$nums;
Constant function support
Constant functions are now supported by the const subroutine attribute. Once the function is executed, its value is saved, and the value is used from the second time onward. This feature is experimental.
my $value = sub: const{100 * 100};
Double Diamond Operator - Safer Diamond Operator
A safer double diamond operator "<< >>" is now supported. Traditional diamond operators use the two-argument open function internally, while double-diamond operators use the three-argument open function.
my $line = <<>>;
encoding module now has lexical scope
The encoding module is a deprecated module, but it is still alive. Therefore, the range of impact when using encoding as a functional improvement has changed from global to lexical. The encoding module can now be partially used, such as on a file-by-file basis.
Deprecated features
Converting all
warnings to fatal errors has been deprecated.
Any statement that makes all warnings fatal errors has been deprecated. The following description is deprecated in the future and should be avoided.
use warnings FATAL =>'all';
This is because when the Perl core adds a new warning, there is a risk that the previously running application will get stuck due to an error. It seems that Perl's core team has opted for safe addition of new warnings rather than full compatibility. I also agree with this.
Incompatible changes
The following description resulted in an error.
defined(@array) defined(%hash)
This description was deprecated as of 5.6.1, and in 5.16, a warning of deprecation was issued, but in 5.22, an error occurred. When upgrading Perl, please note that the old source code may have this description.
Module off core
CGI module is off core
The CGI module is off the core. This may come as a surprise, but it's also a trend of the times. After that, please install and use it from CPAN.
Today, the mainstream is to develop web applications using web frameworks. You can find the framework you need for web development from the following pages.
Module::Build is off core
Module::Build has been removed from the core. When Module::Build is needed, it has been removed for the purpose of having a mechanism in Perl that automatically installs from CPAN and to keep core management as small as possible.
Summary
First of all, I like Perl's enhancements to math-related features. We're happy to see the addition of features that cover areas where Perl is lagging behind.
Also, I think it's great that the performance of methods and multi-level dereference has improved. For example, it was reported that the Perl web framework Mojolicious had a performance improvement of 20%or more after upgrading to Perl 5.22.
Also, I'm happy to say that converting warnings to fatal errors has been deprecated, giving you the possibility to add them when "use warnings " is "use v5.xx". It was opened. Early policy changes will help improve functions later.