Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
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
75
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
97
1.21 Gigawatts
rjbs
3
730
Perl 5: Postcards from the Edge
rjbs
1
1k
Perl: Today, Tomorrow, and Christmas
rjbs
0
150
Perl 5.16 for the Working Programmer
rjbs
0
120
Perl 5.14 for Pragmatists
rjbs
0
110
Perl 5.12 for Everyday Use
rjbs
0
210
Dist::Zilla — raaaaaaaaar!
rjbs
1
550
Validating Data Everywhere with Rx
rjbs
0
180
Other Decks in Programming
See All in Programming
新メンバーも今日から大活躍!SREが支えるスケールし続ける組織のオンボーディング
honmarkhunt
5
8.7k
おやつのお供はお決まりですか?@WWDC25 Recap -Japan-\(region).swift
shingangan
0
140
猫と暮らす Google Nest Cam生活🐈 / WebRTC with Google Nest Cam
yutailang0119
0
170
ふつうの技術スタックでアート作品を作ってみる
akira888
1
1.3k
『自分のデータだけ見せたい!』を叶える──Laravel × Casbin で複雑権限をスッキリ解きほぐす 25 分
akitotsukahara
2
660
Vibe Codingの幻想を超えて-生成AIを現場で使えるようにするまでの泥臭い話.ai
fumiyakume
10
4.3k
Google Agent Development Kit でLINE Botを作ってみた
ymd65536
2
260
テストから始めるAgentic Coding 〜Claude Codeと共に行うTDD〜 / Agentic Coding starts with testing
rkaga
15
5.6k
20250708_JAWS_opscdk
takuyay0ne
2
130
“いい感じ“な定量評価を求めて - Four Keysとアウトカムの間の探求 -
nealle
2
12k
バイブコーディング超えてバイブデプロイ〜CloudflareMCPで実現する、未来のアプリケーションデリバリー〜
azukiazusa1
0
350
The Niche of CDK Grant オブジェクトって何者?/the-niche-of-cdk-what-isgrant-object
hassaku63
1
620
Featured
See All Featured
How STYLIGHT went responsive
nonsquared
100
5.6k
Product Roadmaps are Hard
iamctodd
PRO
54
11k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
8
700
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
3.9k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.4k
Bash Introduction
62gerente
613
210k
Thoughts on Productivity
jonyablonski
69
4.7k
Side Projects
sachag
455
42k
Building Flexible Design Systems
yeseniaperezcruz
328
39k
The World Runs on Bad Software
bkeepers
PRO
70
11k
Navigating Team Friction
lara
187
15k
Why Our Code Smells
bkeepers
PRO
337
57k
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