Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Perl 5.22 and You
Search
Ricardo Signes
June 18, 2015
Programming
0
88
Perl 5.22 and You
Ricardo Signes
June 18, 2015
Tweet
Share
More Decks by Ricardo Signes
See All by Ricardo Signes
Perl 5 at 20: Perl v5.20.0
rjbs
1
110
1.21 Gigawatts
rjbs
3
940
Perl 5: Postcards from the Edge
rjbs
1
1.1k
Perl: Today, Tomorrow, and Christmas
rjbs
0
170
Perl 5.16 for the Working Programmer
rjbs
0
130
Perl 5.14 for Pragmatists
rjbs
0
120
Perl 5.12 for Everyday Use
rjbs
0
220
Dist::Zilla — raaaaaaaaar!
rjbs
1
580
Validating Data Everywhere with Rx
rjbs
0
190
Other Decks in Programming
See All in Programming
手が足りない!兼業データエンジニアに必要だったアーキテクチャと立ち回り
zinkosuke
0
660
生成AIを利用するだけでなく、投資できる組織へ
pospome
2
320
バックエンドエンジニアによる Amebaブログ K8s 基盤への CronJobの導入・運用経験
sunabig
0
150
DSPy Meetup Tokyo #1 - はじめてのDSPy
masahiro_nishimi
1
160
開発に寄りそう自動テストの実現
goyoki
2
910
令和最新版Android Studioで化石デバイス向けアプリを作る
arkw
0
400
チームをチームにするEM
hitode909
0
320
從冷知識到漏洞,你不懂的 Web,駭客懂 - Huli @ WebConf Taiwan 2025
aszx87410
2
2.5k
Developing static sites with Ruby
okuramasafumi
0
280
【Streamlit x Snowflake】データ基盤からアプリ開発・AI活用まで、すべてをSnowflake内で実現
ayumu_yamaguchi
1
120
俺流レスポンシブコーディング 2025
tak_dcxi
14
8.7k
堅牢なフロントエンドテスト基盤を構築するために行った取り組み
shogo4131
8
2.3k
Featured
See All Featured
Code Reviewing Like a Champion
maltzj
527
40k
Leading Effective Engineering Teams in the AI Era
addyosmani
8
1.3k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
10
720
Practical Orchestrator
shlominoach
190
11k
Context Engineering - Making Every Token Count
addyosmani
9
500
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
285
14k
GitHub's CSS Performance
jonrohan
1032
470k
VelocityConf: Rendering Performance Case Studies
addyosmani
333
24k
Reflections from 52 weeks, 52 projects
jeffersonlam
355
21k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
196
70k
Principles of Awesome APIs and How to Build Them.
keavy
127
17k
Transcript
Perl 5.22 your highly syntactic programming pal
5.x
5.x •every year a new stable perl 5
5.x •every year a new stable perl 5 •each one
better* than the last
5.x •every year a new stable perl 5 •each one
better* than the last •every month a new dev perl 5
5.x •every year a new stable perl 5 •each one
better* than the last •every month a new dev perl 5 •each one different than the last
5.x •every year a new stable perl 5 •each one
better* than the last •every month a new dev perl 5 •each one different than the last * says me
Code Ejection
Code Ejection delete the old crazy stuff
Code Ejection delete the old crazy stuff (to make room
for the new crazy stuff)
sigilless style
sigilless style push @array, 1, 2, 3, 4;
sigilless style push @array, 1, 2, 3, 4; for (keys
%hash) { ... }
sigilless style push @array, 1, 2, 3, 4; for (keys
%hash) { ... }
sigilless style push @array, 1, 2, 3, 4; for (keys
%hash) { ... } push array, 1, 2, 3, 4;
sigilless style push @array, 1, 2, 3, 4; for (keys
%hash) { ... } push array, 1, 2, 3, 4; for (keys hash) { ... }
sigilless style push @array, 1, 2, 3, 4; for (keys
%hash) { ... } push array, 1, 2, 3, 4; for (keys hash) { ... }
hash refauxrence
hash refauxrence my $value = $hash{key};
hash refauxrence my $value = $hash{key}; $hash{key} = $new;
hash refauxrence my $value = $hash{key}; $hash{key} = $new;
hash refauxrence my $value = $hash{key}; $hash{key} = $new; my
$value = %hash->{key};
hash refauxrence my $value = $hash{key}; $hash{key} = $new; my
$value = %hash->{key}; %hash->{key} = $new;
hash refauxrence my $value = $hash{key}; $hash{key} = $new; my
$value = %hash->{key}; %hash->{key} = $new;
?regex?
?regex? for (1..10) { say if /./ }
?regex? for (1..10) { say if /./ } for (1..10)
{ say if ?.? }
?regex? for (1..10) { say if /./ } for (1..10)
{ say if ?.? }
?regex? for (1..10) { say if /./ } for (1..10)
{ say if ?.? } for (1..10) { say if m?.? }
collection definedness
collection definedness if (defined @array) { ... }
collection definedness if (defined @array) { ... }
collection definedness if (defined @array) { ... } if (defined
%hash) { ... }
collection definedness if (defined @array) { ... } if (defined
%hash) { ... }
"\cX" "\c@" "\c " "\c牃" "\c¿"
"\cX" "\c@" "\c " "\c牃" "\c¿" "\cX" ==> CANCEL
"\cX" "\c@" "\c " "\c牃" "\c¿" "\cX" ==> CANCEL "\c@"
==> NUL
"\cX" "\c@" "\c " "\c牃" "\c¿" "\cX" ==> CANCEL "\c@"
==> NUL "\c " ==> GRAVE ACCENT
"\cX" "\c@" "\c " "\c牃" "\c¿" "\cX" ==> CANCEL "\c@"
==> NUL "\c " ==> GRAVE ACCENT "\c牃" ==> LATIN CAPITAL LETTER X
"\cX" "\c@" "\c " "\c牃" "\c¿" "\cX" ==> CANCEL "\c@"
==> NUL "\c " ==> GRAVE ACCENT "\c牃" ==> LATIN CAPITAL LETTER X "\c¿" ==> Hmmm…
~$ perl -de0 Loading DB routines from perl5db.pl version 1.28
Editor support available. Enter h or `h h' for help, or `man perldebug' for more help. main::(-e:1): 0 DB<1>
~$ perl -de0 Loading DB routines from perl5db.pl version 1.28
Editor support available. Enter h or `h h' for help, or `man perldebug' for more help. main::(-e:1): 0 DB<1> x "\c¿"
~$ perl -de0 Loading DB routines from perl5db.pl version 1.28
Editor support available. Enter h or `h h' for help, or `man perldebug' for more help. main::(-e:1): 0 DB<1> x "\c¿" 0 '??'
None
DB<1> $str = q{"\c}
DB<1> $str = q{"\c} . chr(0xBF)
DB<1> $str = q{"\c} . chr(0xBF) That's ¿
DB<1> $str = q{"\c} . chr(0xBF) . q{"}; That's ¿
DB<1> $str = q{"\c} . chr(0xBF) . q{"}; DB<2> $res
= eval $str; That's ¿
DB<1> $str = q{"\c} . chr(0xBF) . q{"}; DB<2> $res
= eval $str; DB<3> x $res That's ¿
DB<1> $str = q{"\c} . chr(0xBF) . q{"}; DB<2> $res
= eval $str; DB<3> x $res 0 '?' That's ¿
DB<1> $str = q{"\c} . chr(0xBF) . q{"}; DB<2> $res
= eval $str; DB<3> x $res 0 '?' That's ¿
DB<1> $str = q{"\c} . chr(0xBF) . q{"}; DB<2> $res
= eval $str; DB<3> x $res 0 '?' DB<4> x ord $res That's ¿
DB<1> $str = q{"\c} . chr(0xBF) . q{"}; DB<2> $res
= eval $str; DB<3> x $res 0 '?' DB<4> x ord $res 0 255 That's ¿
None
say "\c¿";
say "\c¿";
say "\c¿"; FATAL!! Must be printable ASCII!
say $^H; # <-- private compile-time hints
say $^H; # <-- private compile-time hints say ; #
<-- private compile-time hints
say $^H; # <-- private compile-time hints say ; #
<-- private compile-time hints say $爳; # <-- private compile-time hints
$^K ==
$VT $^K ==
UNIVERSAL exports use UNIVERSAL;
UNIVERSAL exports use UNIVERSAL 'isa';
good bye, old modules
Module::Build
CGI.pm
you will be missed
you will be missed remembered
you will be missed remembered available on CPAN
good bye, jerkiness
p5p standards of conduct
p5p conduct •be civil •if you can't be civil, you
will be escorted out of the building
okay, but what's new in Perl??
filehandles
(<>) while (<>) { print if /awesome/; }
(<>) while (<>) { print if /awesome/; } $ some-thing
| your-program
(<>) while (<>) { print if /awesome/; } $ some-thing
| your-program $ your-program xyz.txt abc.txt
(<>) while (<>) { print if /awesome/; } while ($ARGV
= shift) { open(ARGV, $ARGV); while (<ARGV>) { ... } }
(<>) while (<>) { print if /awesome/; } while ($ARGV
= shift) { open(ARGV, $ARGV); while (<ARGV>) { ... } }
(<>) while (<>) { print if /awesome/; } $ some-thing
| your-program $ your-program xyz.txt abc.txt
(<>) while (<>) { print if /awesome/; } $ your-program
xyz.txt 'rm -rfv *|' $ some-thing | your-program $ your-program xyz.txt abc.txt
(<<>>) while (<<>>) { print if /awesome/; } $ your-program
xyz.txt abc.txt $ some-thing | your-program $ your-program xyz.txt 'rm -rfv *|'
open -| open my $fh, "-|", "program", @args;
implicit close open my $fh, '>', 'output.txt'; print { $fh
} $_ for @results;
implicit close { open my $fh, '>', 'output.txt'; print {
$fh } $_ for @results; }
{ open my $fh, '>', 'output.txt'; print { $fh }
$_ for @results; } # $fh is closed implicitly implicit close
{ open my $fh, '>', 'output.txt'; print { $fh }
$_ for @results; } # $fh is closed implicitly # but the disk is full implicit close
{ open my $fh, '>', 'output.txt'; print { $fh }
$_ for @results; } # $fh is closed implicitly # but the disk is full # so the close fails implicit close
{ open my $fh, '>', 'output.txt'; print { $fh }
$_ for @results; } # $fh is closed implicitly # but the disk is full # so the close fails # silently implicit close
{ open my $fh, '>', 'output.txt'; print { $fh }
$_ for @results; } # $fh is closed implicitly # but the disk is full # so the close fails # silently # :-( implicit close
{ open my $fh, '>', 'output.txt'; print { $fh }
$_ for @results; } # warning if close fails! implicit close
{ open my $fh, '>', 'output.txt'; print { $fh }
$_ for @results; } # warning if close fails! # (...and you can fatalize it) implicit close
{ use warnings FATAL => 'io'; open my $fh, '>',
'output.txt'; print { $fh } $_ for @results; } # warning if close fails! # (...and you can fatalize it) implicit close
Regex Stuff
establishing boundaries
establishing boundaries \b
establishing boundaries Don't think twice. It's all right. \b
establishing boundaries Don't think twice. It's all right. \b
establishing boundaries Don't think twice. It's all right. \b{w}
establishing boundaries Don't think twice. It's all right. \b{w}
establishing boundaries Don't think twice. It's all right. \b{w}
establishing boundaries Don't think twice. It's all right. \b{sb}
establishing boundaries Don't think twice. It's all right. \b{sb}
establishing boundaries Don't think twice. It's all right. /(?!>^)\b{sb}/
establishing boundaries Don't think twice. It's all right. \b{gcb}
establishing boundaries Don't think twice. It's all right. \b{gcb}
establishing boundaries Don't think twice. It's all right. split /\b{gcb}/
establishing boundaries Don't think twice. It's all right. split //
establishing boundaries Queensrÿche split //
establishing boundaries Queensrÿche split //
establishing boundaries Queensry¨che split //
establishing boundaries Queensrÿche split /\b{gcb}/
Avoid Capture
Avoid Capture qr/v(?:[0-9]+)(?:(?:\.[0-9]+)+(?:_[0-9]+)?)?/;
Avoid Capture
Avoid Capture qr/v (?:[0-9]+)
Avoid Capture qr/v (?:[0-9]+) (?: (?: \.[0-9]+ )+
Avoid Capture qr/v (?:[0-9]+) (?: (?: \.[0-9]+ )+ (?: _
[0-9]+ )? )?/x;
Avoid Capture qr/v ( [0-9]+) ( ( \.[0-9]+ )+ (
_ [0-9]+ )? )?/xn;
Avoid Capture qr/v [0-9]+ ( ( \.[0-9]+ )+ ( _
[0-9]+ )? )?/xn;
Avoid Capture qr/v ( [0-9]+) ( ( \.[0-9]+ )+ (
_ [0-9]+ )? )?/xn;
Avoid Capture qr/v (?-n: [0-9]+ ) ( ( \.[0-9]+ )+
(?-n: _ [0-9]+ )? )?/xn;
Avoid Capture qr/v (?<major> [0-9]+ ) ( ( \.[0-9]+ )+
(?<dev> _ [0-9]+ )? )?/xn; %vers = (major => $+{major}, dev => $+{dev});
Avoid Capture qr/v (?<major> [0-9]+ ) ( ( \.[0-9]+ )+
(?<dev> _ [0-9]+ )? )?/xn; %vers = %+{ qw(major dev) };
Pair Slices (from v5.20.0)
my @array = qw[ foo bar baz quux ]; my
@slice = @array[ 1, 3 ]; # Now @slice is ("bar", "quux")
my %hash = (a => 1, b => 2, c
=> 3); my @slice = @hash{ 'a', 'c' }; # Now @slice is (1, 3)
my %hash = (a => 1, b => 2, c
=> 3); my %slice = %hash{ 'a', 'c' }; # Now %slice is (a => 1, c => 3)
my %hash = (a => 1, b => 2, c
=> 3); my @slice = %hash{ 'a', 'd', 'a' }; # Now @slice is # (a => 1, d => undef, a => 1)
my @array = qw[ foo bar baz quux ]; my
@slice = %array[ 1, 3 ]; # @slice is (1 => "bar", 3 => "quux")
my $record = { artist => $album{artist}, title => $album{title},
tracks => $album{tracks}, year => $album{edition}{year}, label => $album{edition}{lable}, };
my $record = { artist => $album{artist}, title => $album{title},
tracks => $album{tracks}, year => $album{edition}{year}, label => $album{edition}{lable}, };
my $record = { artist => $album{artist}, title => $album{title},
tracks => $album{tracks}, year => $album{edition}{year}, label => $album{edition}{label}, };
my $record = { %album{qw( artist title tracks )}, year
=> $album{edition}{year}, label => $album{edition}{label}, };
# Your mission: get a slice of values # from
$hashref->{x} my $hashref = { x => { ... } };
# Your mission: get a slice of values # from
$hashref->{x} my $hashref = { x => { ... } }; $hashref->{x}{ k1, k2 } #1
# Your mission: get a slice of values # from
$hashref->{x} my $hashref = { x => { ... } }; $hashref->{x}{ k1, k2 } #1
# Your mission: get a slice of values # from
$hashref->{x} my $hashref = { x => { ... } }; $hashref->{x}{ k1, k2 } #1 @{ $hashref->{x} }->{ k1, k2 } #2
# Your mission: get a slice of values # from
$hashref->{x} my $hashref = { x => { ... } }; $hashref->{x}{ k1, k2 } #1 @{ $hashref->{x} }->{ k1, k2 } #2
# Your mission: get a slice of values # from
$hashref->{x} my $hashref = { x => { ... } }; $hashref->{x}{ k1, k2 } #1 @{ $hashref->{x} }->{ k1, k2 } #2 @{ $hashref->{x}{ k1, k2 } } #3
# Your mission: get a slice of values # from
$hashref->{x} my $hashref = { x => { ... } }; $hashref->{x}{ k1, k2 } #1 @{ $hashref->{x} }->{ k1, k2 } #2 @{ $hashref->{x}{ k1, k2 } } #3
# Your mission: get a slice of values # from
$hashref->{x} my $hashref = { x => { ... } }; $hashref->{x}{ k1, k2 } #1 @{ $hashref->{x} }->{ k1, k2 } #2 @{ $hashref->{x}{ k1, k2 } } #3 @{ $hashref->{x} }{ k1, k2} #4
my $record = { %album{qw( artist title tracks )}, year
=> $album{edition}{year}, label => $album{edition}{label}, };
my $record = { %album{qw( artist title tracks )}, $album->{edition}->%{
qw(year label) } );
Postfix Dereferencing (from v5.20.0)
push $sess->{user}->logins , @{ $queue->{unflushed}->logins }; process(@{ $queue->{unhandled}->jobs }); map
{ $_ > $#{$in[0]} } @{$job->input}
push $sess->{user}->logins->@* , @{ $queue->{unflushed}->logins }; process(@{ $queue->{unhandled}->jobs }); map
{ $_ > $#{$in[0]} } @{$job->input}
push $sess->{user}->logins->@* , $queue->{unflushed}->logins->@*; process(@{ $queue->{unhandled}->jobs }); map { $_
> $#{$in[0]} } @{$job->input}
push $sess->{user}->logins->@* , $queue->{unflushed}->logins->@*; process($queue->{unhandled}->jobs->@*); map { $_ > $#{$in[0]}
} @{$job->input}
push $sess->{user}->logins->@* , $queue->{unflushed}->logins->@*; process($queue->{unhandled}->jobs->@*); map { $_ > $#{$in[0]}
} $job->input->@*
push $sess->{user}->logins->@* , $queue->{unflushed}->logins->@*; process($queue->{unhandled}->jobs->@*); map { $_ > $in[0]->$#*
} $job->input->@*
@{ expr } ⇢ ⇢ ⇢ ⇢ expr->@* %{ expr
} ⇢ ⇢ ⇢ ⇢ expr->%* ${ expr } ⇢ ⇢ ⇢ ⇢ expr->$* &{ expr } ⇢ ⇢ ⇢ ⇢ expr->&* *{ expr } ⇢ ⇢ ⇢ ⇢ expr->** $#{ expr } ⇢ ⇢ ⇢ ⇢ expr->$#*
@{ expr }[1,2,3] ⇢ expr->@[1,2,3] @{ expr }{k1,k2} ⇢ expr->@{k1,k2}
%{ expr }[1,2,3] ⇢ expr->%[1,2,3] %{ expr }{k1,k2} ⇢ expr->%{k1,k2} *{ expr }{ARRAY} ⇢ expr->*{ARRAY}
say "Items: $arrayref->@*[0,1]" say "Content: $body_ref->$*"
Postfix Dereferencing (use experimental 'postderef')
reference aliasing (from v5.22.0)
None
my @array = (1, 2, 3, 4);
my @array = (1, 2, 3, 4); my $ref =
\@array;
my @array = (1, 2, 3, 4); my $ref =
\@array;
my @array = (1, 2, 3, 4); my $ref =
\@array; shift @$ref;
my @array = (1, 2, 3, 4); my $ref =
\@array; shift @$ref;
my @array = (1, 2, 3, 4); my $ref =
\@array; shift @$ref; say "@array";
my @array = (1, 2, 3, 4); my $ref =
\@array; shift @$ref; say "@array";
my @array = (1, 2, 3, 4); my $ref =
\@array; shift @$ref; say "@array"; 2 3 4
my @array = (1, 2, 3, 4); my @copy =
@array; shift @copy; say "@array"; 1 2 3 4
my @array = (1, 2, 3, 4); \my @alias =
\@array; shift @alias; say "@array"; 2 3 4
my @array = (1, 2, 3, 4); \my @alias =
\@array; shift @alias; say "@array"; 2 3 4
my @todo = ({ what => 'eat pie', when =>
'right now' }, { what => 'eat cake', when => 'quite soon' }); for my $item (@todo) { say "Please $item->{what} $item->{when}." }
my @todo = ({ what => 'eat pie', when =>
'right now' }, { what => 'eat cake', when => 'quite soon' }); for my $item (@todo) { say "Please $item->{what} $item->{when}." }
my @todo = ({ what => 'eat pie', when =>
'right now' }, { what => 'eat cake', when => 'quite soon' }); for \my %todo (@todo) { say "Please $item{what} $item{when}." }
my $href = $some->awful->[0]->{chain}; for my $key (keys %$hash) {
say "$key: $hash->{$key}"; }
\my %href = $some->awful->[0]->{chain}; for my $key (keys %hash) {
say "$key: $hash{$key}"; }
{ \my %href = $some->awful->[0]->{chain}; for my $key (keys %hash)
{ say "$key: $hash{$key}"; } }
for \my %hash ($some->awful->[0]->{chain}) { for my $key (keys %hash)
{ say "$key: $hash{$key}"; } }
reference aliasing (use experimental 'refaliasing')
fasterization
fasterization my @array = split /.../, $string;
fasterization package MyClass { sub new { ... } }
my $obj = MyClass->new;
fasterization package MyClass { sub new { ... } }
my $obj = MyClass->new; $obj->UNIVERSAL::isa( ... );
fasterization package MyClass { sub new { ... } }
my $obj = MyClass->new; $obj->SUPER::new( ... );
fasterization OP_METHOP
fasterization OP_MULTIDEREF
fasterization my $x = $a->[0]{one}[2]{three}{four}[5];
fasterization my $x = $a
fasterization my $x = $a->[0]
fasterization my $x = $a->[0]{one}
fasterization my $x = $a->[0]{one}[2]
fasterization my $x = $a->[0]{one}[2]{three}
fasterization my $x = $a->[0]{one}[2]{three}{four}
fasterization my $x = $a->[0]{one}[2]{three}{four}[5];
fasterization my $x = $a
fasterization my $x = $a->[0]{one}[2]{three}{four}[5];
NaN nananananananananana
None
==> x (Inf)
==> x (Inf) 'Inf'
==> x (Inf) 'Inf' ==> x (Inf + 0)
==> x (Inf) 'Inf' ==> x (Inf + 0) 'Inf'
==> x (Inf) 'Inf' ==> x (Inf + 0) 'Inf'
==> x (Inf + Inf)
==> x (Inf) 'Inf' ==> x (Inf + 0) 'Inf'
==> x (Inf + Inf) 'Inf'
==> x (Inf) 'Inf' ==> x (Inf + 0) 'Inf'
==> x (Inf + Inf) 'Inf' ==> x (Inf - Inf)
==> x (Inf) 'Inf' ==> x (Inf + 0) 'Inf'
==> x (Inf + Inf) 'Inf' ==> x (Inf - Inf) 'NaN'
==> x (Inf) 'Inf' ==> x (Inf + 0) 'Inf'
==> x (Inf + Inf) 'Inf' ==> x (Inf - Inf) 'NaN' ==> x (Inf * 0)
==> x (Inf) 'Inf' ==> x (Inf + 0) 'Inf'
==> x (Inf + Inf) 'Inf' ==> x (Inf - Inf) 'NaN' ==> x (Inf * 0) 'NaN'
==> x (Inf) 'Inf' ==> x (Inf + 0) 'Inf'
==> x (Inf + Inf) 'Inf' ==> x (Inf - Inf) 'NaN' ==> x (Inf * 0) 'NaN' ==> x (NaN + NaN)
==> x (Inf) 'Inf' ==> x (Inf + 0) 'Inf'
==> x (Inf + Inf) 'Inf' ==> x (Inf - Inf) 'NaN' ==> x (Inf * 0) 'NaN' ==> x (NaN + NaN) 'NaN'
==> x (Inf) 'Inf' ==> x (Inf + 0) '#1.INF'
==> x (Inf + Inf) '#1.INF' ==> x (Inf - Inf) '#1.IND' ==> x (Inf * 0) '#1.IND' ==> x (NaN + NaN) '#1.QNAN'
==> x (Inf) 'Inf' ==> x (Inf + 0) 'Inf'
==> x (Inf + Inf) 'Inf' ==> x (Inf - Inf) 'NaN' ==> x (Inf * 0) 'NaN' ==> x (NaN + NaN) 'NaN'
None
==> x (0 + "Nan")
==> x (0 + "Nan") 'NaN'
==> x (0 + "Nan") 'NaN' ==> x (0 +
"Nancy")
==> x (0 + "Nan") 'NaN' ==> x (0 +
"Nancy") 'NaN'
==> x (0 + "Nan") 'NaN' ==> x (0 +
"Nancy") 'NaN' ==> x (0 + "123abc")
==> x (0 + "Nan") 'NaN' ==> x (0 +
"Nancy") 'NaN' ==> x (0 + "123abc") 123
==> x (0 + "Nan") 'NaN' ==> x (0 +
"Nancy") 'NaN' ==> x (0 + "123abc") Argument "123abc" isn't numeric 123
==> x (0 + "Nan") 'NaN' ==> x (0 +
"Nancy") 'NaN' ==> x (0 + "123abc") Argument "123abc" isn't numeric 123 ==> x (0 + "Nancy, this is Susan. Susan, this is Nancy.\n\n...") 'NaN'
==> x (0 + "Nan") 'NaN' ==> x (0 +
"Nancy") Argument "Nancy" isn't numeric 'NaN' ==> x (0 + "123abc") Argument "123abc" isn't numeric 123 ==> x (0 + "Nancy, this is Susan. Susan, this is Nancy.\n\n...") Argument "Nancy, this is Susan... 'NaN'
not not a numbers
hex floats $x = 1.23e4;
hex floats $x = 0xE.A3p4;
hex floats $x = 1.23e4;
hex floats $x = 1.23e4; $x = ( 1 +
23 / 100 ) * 10**4;
hex floats $x = 0xE.A3p4;
hex floats $x = 0xE.A3p4; $x = ( 0xE +
0xA3 / 0x100 ) * 2**4;
hex floats $x = 0xE.A3p4;
hex floats $x = 0xE.A3p4; # 234.1875
hex floats $x = 0xE.A3p4; # 234.1875 printf "%x", $x;
# "ea"
hex floats $x = 0xE.A3p4; # 234.1875 printf "%x", $x;
# "ea" printf "%a", $x; # 0x1.d46p+7
hex floats $x = 0xE.A3p4; # 234.1875 printf "%x", $x;
# "ea" printf "%a", $x; # 0x1.d46p+7 :-)
speaking of numbers and not-numbers
None
NAME!
NAME! THAT!
NAME! THAT! OPERATOR!
name that operator
name that operator $x + $y
name that operator $x + $y $x - $y
name that operator $x + $y $x - $y $x
* $y
name that operator $x + $y $x - $y $x
* $y $x / $y
name that operator
name that operator $x eq $y
name that operator $x eq $y $x ne $y
name that operator $x eq $y $x ne $y $x
lt $y
name that operator $x eq $y $x ne $y $x
lt $y $x gt $y
name that operator
name that operator $x ~~ $y
name that operator
name that operator $x && $y
name that operator $x && $y $x || $y
name that operator $x && $y $x || $y $x
xor $y
name that operator
name that operator $x & $y
name that operator $x & $y $x | $y
name that operator $x & $y $x | $y $x
^ $y
name that operator $x & $y $x | $y $x
^ $y ~ $x
bitwise operator types
bitwise operator types $num1 & $num2
bitwise operator types $num1 & $num2 $str1 & $str2
bitwise operator types $num1 & $num2 $str1 & $str2 $num1
& $str2
bitwise operator types $num1 & $num2 $str1 & $str2 $num1
& $str2 $str1 & $num2
bitwise operator types
bitwise operator types use experimental 'bitwise';
bitwise operator types use experimental 'bitwise';
bitwise operator types use experimental 'bitwise'; $x & $y
bitwise operator types use experimental 'bitwise'; $x & $y $x
&. $y
bitwise operator types
bitwise operator types use experimental 'bitwise';
bitwise operator types use experimental 'bitwise';
bitwise operator types use experimental 'bitwise'; $x | $y
bitwise operator types use experimental 'bitwise'; $x | $y $x
|. $y
bitwise operator types
bitwise operator types use experimental 'bitwise';
bitwise operator types use experimental 'bitwise';
bitwise operator types use experimental 'bitwise'; $x ^ $y
bitwise operator types use experimental 'bitwise'; $x ^ $y $x
^. $y
bitwise operator types
bitwise operator types use experimental 'bitwise';
bitwise operator types use experimental 'bitwise';
bitwise operator types use experimental 'bitwise'; ~ $x
bitwise operator types use experimental 'bitwise'; ~ $x ~. $x
bitstring ops
bitstring ops use experimental 'bitwise';
bitstring ops use experimental 'bitwise';
bitstring ops use experimental 'bitwise'; my $x = "" &.
"";
bitstring ops use experimental 'bitwise'; my $x = "" &.
""; say $x;
(@) (from v5.20.0)
sub add { my ($x, $y) = @_; return $x
+ $y; }
sub add ($x, $y) { return $x + $y; }
sub add ($x, $y = 0) { return $x +
$y; }
sub add ($x = 0, $y = 0) { return
$x + $y; }
sub add ($x = 0, $y = return $x) {
return $x + $y; }
sub add ($x= (return 0), $y= return $x) { return
$x + $y; }
sub add ( $x = (return 0), $y = return
$x + do { my $dbh = DBI->connect($DSN); my ($y) = $dbh->selectrow_array( "SELECT rhs FROM op_defaults WHERE op = '+'" ); $y } ) { return $x + $y; }
sub mult_many { my ($factor, @inputs) = @_; return map
{; $factor * $_ } @inputs }
sub mult_many ($factor, @inputs) { return map {; $factor *
$_ } @inputs }
sub send_mail ($self, $mail, %arg) { $self->smtp->deliver( $mail, %arg{ 'from',
'to' }, ); }
sub each ($code, @rest) :prototype(&@) { $code->($_) for @rest; }
each { say } (1, 2, 3);
sub each :prototype(&@) ($code, @rest) { $code->($_) for @rest; }
each { say } (1, 2, 3);
sub process_queue { my ($self, $arg, $queue) = @_; for
my $item ( @$queue ) { debug($item->{name}) if $arg->{debug}; $self->accept($item->{job_id}); } }
sub process_queue ($self, $arg, $queue) { for my $item (
@$queue ) { debug($item->{name}) if $arg->{debug}; $self->accept($item->{job_id}); } }
sub process_queue ($self, $arg, $queue) { for \my %item (
@$queue ) { debug($item{name}) if $arg->{debug}; $self->accept($item{job_id}); } }
sub process_queue ($self, $arg, $queue) { for \my %item (
@$queue ) { debug($item{name}) if $arg->{debug}; $self->accept($item{job_id}); } }
sub process_queue ($self, \%arg, \@queue) { for \my %item (
@queue ) { debug($item{name}) if $arg{debug}; $self->accept($item{job_id}); } }
Perl 5.22
Perl 5.22 available now!
Perl 5.22
Perl 5.22 available now!
Perl 5.22 available now! higher version number than ever before!
Any Questions?
Thank you!
Perl 5.24?
warnings
warnings
warnings •use warnings;
warnings •use warnings; •use warnings 'all';
warnings •use warnings; •use warnings 'all'; •use warnings 'FATAL';
warnings •use warnings; •use warnings 'all'; •use warnings 'FATAL'; •use
warnings FATAL => 'all';
warnings use warnings; my $re = qr/(?:-)xyz/;
warnings use warnings; my $re = qr/(?:-)xyz/; Probably-accidental smiley found
in regexp at line 2
None
massive mailing list thread about :-)
massive mailing list thread about :-)
massive mailing list thread about :-) which is :-(
warnings
warnings •use warnings;
warnings •use warnings; •use warnings 'default';
warnings •use warnings; •use warnings 'default'; •use warnings 'FATAL';
warnings •use warnings; •use warnings 'default'; •use warnings 'FATAL'; •use
warnings FATAL => 'default';
warnings use warnings; my $re = qr/(?:-)xyz/;
warnings use warnings qw(default smileys); my $re = qr/(?:-)xyz/; Probably-accidental
smiley found in regexp at line 2
warnings use warnings 'all'; my $re = qr/(?:-)xyz/; Probably-accidental smiley
found in regexp at line 2
strictures
strictures use strict; while ( my $event = next_event )
{ print { $logfile } "$event\n"; }
strictures # logfile.txt Garbo::Event=HASH(0x03941ae0f) Garbo::Event=HASH(0x03944a30f) Garbo::Event=HASH(0x03941af0f) Garbo::Event=HASH(0x031411eff) Garbo::Event=HASH(0x039110020) Garbo::Event=HASH(0x03941ae0f)
strictures use strict 'stringification'; while ( my $event = next_event
) { print { $logfile } "$event\n"; } Can't stringify a reference with no overloading while "strict stringification" in use