ThePerlReview•www.theperlreview.com
Perlv5.28NewFeatures
Perl 5.28
New Features
www.perl.org
Alpine Perl Workshop 2016 • brian d foy
ThePerlReview•www.theperlreview.com
Perlv5.28NewFeatures
Auto referencing
use feature qw(auto_ref);
no warnings qw(experimental::autoref);
foo( %hash, @array );
sub foo ( %hash, @array ) {
…
}
ThePerlReview•www.theperlreview.com
Perlv5.28NewFeatures
Fancier signatures
use feature qw(signatures);
no warnings qw(experimental::signatures);
sub foo ( $date[DateTime] ) { … }
sub bar ( $n[Int]/Rat/ ) { … }
sub baz ( $n[+&bar] ) { … }
sub quux ( $[+&bar|Int] ) { … }
ThePerlReview•www.theperlreview.com
Perlv5.28NewFeatures
Distributed map / grep
use feature qw(parallel);
no warnings qw(experimental::parallel);
@{^PERL_WORKER_POOL} = ‘192.168.1/8’;
my @transformed = map { foo() } @array;
sub foo :distributive { … }
ThePerlReview•www.theperlreview.com
Perlv5.28NewFeatures
Better Safe
use feature qw(safe);
no warnings qw(experimental::safe);
use safe qw(:all);
no safe qw(regex networking);
m/…/; # dies at compile time
{ # new READONLY ${^PERL_LEVEL}
no safe qw(:level1);
…
}
ThePerlReview•www.theperlreview.com
Perlv5.28NewFeatures
Three-state TAP
ok 1 - 2 + 2 = 4
ok 2 - 2 - 2 = 0
not 3 - 2 + 2 = 5
meh 4 - documentation is correct
ok 5 - Another test passed
ThePerlReview•www.theperlreview.com
Perlv5.28NewFeatures
Close enough comparators
7 =? 8 # True
7 !=? 9 # False
7 >+ 6 # False
7 >+ 3 # True
7 >++ 3 # False
7 <+ 9 # False
7 <+ 14 # True
7 <++ 14 # False
ThePerlReview•www.theperlreview.com
Perlv5.28NewFeatures
New array operators
unshift @array, 6; # ( 6 )
push @array, 2; # ( 6, 2 )
shove @array, 4; # ( 6, 4, 2)
cutin @array, 5; # ( 6, 5, 4, 2 )
vip @array, 7; # ( 6, 3, 4, 2 )
ThePerlReview•www.theperlreview.com
Perlv5.28NewFeatures
Upgradable =
my $scalar =^ ( 1,, 2,, 3,, 4,, );
say $scalar; # fatal, no $scalar
say “@scalar”; # 1 2 3 4
my @array =^ ( cat >=> Buster ); # %array
use feature qw(upgrade_assign);
ThePerlReview•www.theperlreview.com
Perlv5.28NewFeatures
Yada Yada Alotta
use feature qw(alotta);
no warnings qw(experimental::alotta);
while (<>) {
…
}
ThePerlReview•www.theperlreview.com
Perlv5.28NewFeatures
Better Git Interop
•Compiler recognizes conflict markers
•Will run both versions
•Chooses version with right answer
ThePerlReview•www.theperlreview.com
Perlv5.28NewFeatures
Better Diagnostics
•“(W+) Warnings turned off in lexical scope,
but this warning is really important.”
•“(P) Converting code into another way to
do it. Ways to do counter is 3 (2 to go).”
•“(I) Nope. Just, nope.”
•“(0) This program appears to be a waste of
time. Exiting.”

Perl 5.28 new features