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
170
Other Decks in Programming
See All in Programming
AI時代の『改訂新版 良いコード/悪いコードで学ぶ設計入門』 / ai-good-code-bad-code
minodriven
13
3.5k
レベル1の開発生産性向上に取り組む − 日々の作業の効率化・自動化を通じた改善活動
kesoji
0
190
PipeCDのプラグイン化で目指すところ
warashi
1
270
Node-RED を(HTTP で)つなげる MCP サーバーを作ってみた
highu
0
120
システム成長を止めない!本番無停止テーブル移行の全貌
sakawe_ee
1
200
AIと”コードの評価関数”を共有する / Share the "code evaluation function" with AI
euglena1215
1
160
Google Agent Development Kit でLINE Botを作ってみた
ymd65536
2
250
Hypervel - A Coroutine Framework for Laravel Artisans
albertcht
1
120
おやつのお供はお決まりですか?@WWDC25 Recap -Japan-\(region).swift
shingangan
0
130
チームで開発し事業を加速するための"良い"設計の考え方 @ サポーターズCoLab 2025-07-08
agatan
1
420
データの民主化を支える、透明性のあるデータ利活用への挑戦 2025-06-25 Database Engineering Meetup#7
y_ken
0
360
What Spring Developers Should Know About Jakarta EE
ivargrimstad
0
470
Featured
See All Featured
Unsuck your backbone
ammeep
671
58k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
35
2.4k
Six Lessons from altMBA
skipperchong
28
3.9k
Building Applications with DynamoDB
mza
95
6.5k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
181
54k
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
Rails Girls Zürich Keynote
gr2m
95
14k
A Tale of Four Properties
chriscoyier
160
23k
Embracing the Ebb and Flow
colly
86
4.7k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
Producing Creativity
orderedlist
PRO
346
40k
Docker and Python
trallard
44
3.5k
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