Your SlideShare is downloading. ×
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

What's New in Perl? v5.10 - v5.16

2,676

Published on

This talk describes the most likely-to-be-used features added to Perl 5 between v5.10 and v5.16, inclusive.

This talk describes the most likely-to-be-used features added to Perl 5 between v5.10 and v5.16, inclusive.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
2,676
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
20
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Perl 5 whats new?
  • 2. Perl 5.10for people who are not totally insane
  • 3. Perl 5.12 for everyday use
  • 4. Perl 5.14 for pragmatists
  • 5. Perl 5.16for the working programmer
  • 6. Lexical Semantics!
  • 7. use feature ‘say’;say “This is a test!”;{ no feature ‘say’; say “This is fatal!”;}
  • 8. use 5.16.0;say “This is a test!”;{ no feature ‘say’; say “This is fatal!”;}
  • 9. #!/usr/bin/perluse strict;use warnings;use 5.16.0; # use feature ‘:5.16’;my $x = Reticulator->new;$x->reticulate(@splines);
  • 10. #!/usr/bin/perluse strict;use warnings; # no feature;my $x = Reticulator->new;$x->reticulate(@splines);
  • 11. #!/usr/bin/perluse strict;use warnings; # use feature ‘:default’my $x = Reticulator->new;$x->reticulate(@splines);
  • 12. array_base: $[
  • 13. Cool New Features!
  • 14. Better Error Message(s)$str = “Greetings, $name. Your lastlogin was $last. It is now $time.”; perldiag
  • 15. Better Error Message(s)$str = “Greetings, $name. Your lastlogin was $last. It is now $time.”;Use of uninitialized value inconcatenation (.) or string athello.plx line 9. perldiag
  • 16. Better Error Message(s)$str = “Greetings, $name. Your lastlogin was $last. It is now $time.”;Use of uninitialized value $time inconcatenation (.) or string athello.plx line 9. perldiag
  • 17. State Variablesmy $LINES_READ = 0;sub read_line { $LINES_READ++; ...} perlsub
  • 18. State Variables{ my $LINES_READ = 0; sub read_line { $LINES_READ++; ... }} perlsub
  • 19. State Variablessub read_line { state $LINES_READ = 0; $LINES_READ++; ...} perlsub
  • 20. truth and definedness perlop
  • 21. truth and definednesssub record_sale { perlop
  • 22. truth and definednesssub record_sale { my ($product, $amount) = @_; perlop
  • 23. truth and definednesssub record_sale { my ($product, $amount) = @_; my $price = $amount perlop
  • 24. truth and definednesssub record_sale { my ($product, $amount) = @_; my $price = $amount || $product->price; perlop
  • 25. truth and definednesssub record_sale { my ($product, $amount) = @_; my $price = $amount || $product->price; ... perlop
  • 26. truth and definednesssub record_sale { my ($product, $amount) = @_; my $price = $amount || $product->price; ...} perlop
  • 27. truth and definednesssub record_sale { my ($product, $amount) = @_; $price = defined $amount ? $amount : $product->price; ...} perlop
  • 28. truth and definednesssub record_sale { my ($product, $amount) = @_; my $price = $amount || $product->price; ...} perlop
  • 29. truth and definednesssub record_sale { my ($product, $amount) = @_; my $price = $amount // $product->price; ...} perlop
  • 30. the new OR operatorsub record_sale { my ($product, $amount) = @_; $amount //= $product->cost; ...} perlop
  • 31. say $what- new built-in, say- it’s like print- but it adds a newline for you perlfunc
  • 32. say $what perlfunc
  • 33. say $whatprint “Hello, world!n”; perlfunc
  • 34. say $whatprint “Hello, world!n”;print “$messagen”; perlfunc
  • 35. say $whatprint “Hello, world!n”;print “$messagen”;print “$_n” for @lines; perlfunc
  • 36. say $whatprint “Hello, world!n”;say “Hello, world!”;print “$messagen”;print “$_n” for @lines; perlfunc
  • 37. say $whatprint “Hello, world!n”;say “Hello, world!”;print “$messagen”;say $message;print “$_n” for @lines; perlfunc
  • 38. say $whatprint “Hello, world!n”;say “Hello, world!”;print “$messagen”;say $message;print “$_n” for @lines;say for @lines; perlfunc
  • 39. $ perl -e ‘print “Foon”’
  • 40. $ perl -e ‘print “Foon”’$ perl -E ‘say “Foo”’
  • 41. Recursion!sub fact { my ($x) = @_; # must be +int return $x if $x == 1; return $x * fact($x - 1);}
  • 42. Recursion!sub fact { my ($x) = @_; # must be +int return $x if $x == 1; return $x * fact($x - 1);}
  • 43. Recursion!my $fact = sub { my ($x) = @_; # must be +int return $x if $x == 1; return $x * $fact->($x - 1);};
  • 44. Recursion!my $fact = sub { my ($x) = @_; # must be +int return $x if $x == 1; return $x * $fact->($x - 1);};
  • 45. Recursion!my $fact;$fact = sub { my ($x) = @_; # must be +int return $x if $x == 1; return $x * $fact->($x - 1);};
  • 46. Recursion!my $fact;$fact = sub { my ($x) = @_; # must be +int return $x if $x == 1; return $x * $fact->($x - 1);};
  • 47. Recursion!use Scalar::Util qw(weaken);my $fact = do { my $f1; my $f2 = $f1 = sub { my ($x) = @_; return $x if $x == 1; return $x * $f1->($x - 1); }; weaken($f1); $f1;};
  • 48. Recursion!use 5.16.0; # current_submy $fact = sub { my ($x) = @_; # must be +int return $x if $x == 1; return $x * __SUB__->($x - 1);};
  • 49. Filehandles!
  • 50. autodieopen my $fh, ‘<‘, $filename;while (<$fh>) { ...}close $fh; autodie
  • 51. autodieopen my $fh, ‘<‘, $filename or die “couldn’t open $filename: $!”;while (<$fh>) { ...}close $fh or die “couldn’t close $filename: $!”; autodie
  • 52. autodieuse autodie;open my $fh, ‘<‘, $filename;while (<$fh>) { ...}close $fh; autodie
  • 53. autodieuse autodie;open my $fh, ‘<‘, $filename;while (<$fh>) { no autodie; rmdir or warn “couldn’t remove $_: $!”;}close $fh; autodie
  • 54. autodieuse autodie;sub foo { my $filename = shift; open my $fh, ‘<‘, $filename; while (<$fh>) { ... }} # this implicit close DID NOT AUTODIE autodie
  • 55. IO::Filesub stream_to_fh { my ($self, $fh) = @_; fileno $fh or die “can’t stream to closed fh”; while (my $hunk = $self->next_hunk) { print {$fh} $hunk; } close $fh or die “error closing: $!”;} perlopentut
  • 56. IO::Filesub stream_to_fh { my ($self, $fh) = @_; $fh->fileno or die “can’t stream to closed fh”; while (my $hunk = $self->next_hunk) { $fh->print($hunk); } $fh->close or die “error closing: $!”;} perlopentut
  • 57. IO::Filesub stream_to_fh { ... $fh->print($hunk); ... $fh->close or die “error closing: $!”;}open my $target, ‘>’, ‘/dev/null’ or die “can’t open bit bucket: $!”;stream_to_fh($target); perlopentut
  • 58. IO::Fileuse IO::File;sub stream_to_fh { ... $fh->print($hunk); ... $fh->close or die “error closing: $!”;}open my $target, ‘>’, ‘/dev/null’ or die “can’t open bit bucket: $!”;stream_to_fh($target); perlopentut
  • 59. IO::Fileuse 5.14.0;sub stream_to_fh { ... $fh->print($hunk); ... $fh->close or die “error closing: $!”;}open my $target, ‘>’, ‘/dev/null’ or die “can’t open bit bucket: $!”;stream_to_fh($target); perlopentut
  • 60. IO::Fileuse 5.14.0;use autodie;sub stream_to_fh { ... $fh->print($hunk); ... $fh->close or die “error closing: $!”;}open my $target, ‘>’, ‘/dev/null’ or die “can’t open bit bucket: $!”;stream_to_fh($target); perlopentut
  • 61. Package Blockspackage Library::Awesome;our $VERSION = 1.234;sub foo { ... }1; perlfunc
  • 62. Package Blocksuse 5.12.0;package Library::Awesome 1.234;sub foo { ... }1; perlfunc
  • 63. Package Blocksuse 5.12.0;package Library::Awesome 1.234-alpha;sub foo { ... }1; perlfunc
  • 64. Package Blockspackage Library::Awesome 1.234 { sub foo { ... }}1; perlfunc
  • 65. overloading- the -x overload- the qr overload- "no overloading"- unknown overload warns perldoc
  • 66. Other New Features!
  • 67. smrt match
  • 68. smrt matchif ($x ~~ $y) { ...}
  • 69. smrt match perldoc
  • 70. smrt match- if $x and $y are unknown, there are 23 possible dispatch paths perldoc
  • 71. smrt match- if $x and $y are unknown, there are 23 possible dispatch paths- and some of them redispatch recursively perldoc
  • 72. smrt match- if $x and $y are unknown, there are 23 possible dispatch paths- and some of them redispatch recursively- no, you wont remember them all perldoc
  • 73. smrt match- if $x and $y are unknown, there are 23 possible dispatch paths- and some of them redispatch recursively- no, you wont remember them all- ...and they cant be intuited perldoc
  • 74. Matching
  • 75. Matchingif ($x ~~ $y) {...}
  • 76. Matchingif ($x ~~ $y) {...}if ($str ~~ %hash) {...}
  • 77. Matchingif ($x ~~ $y) {...}if ($str ~~ %hash) {...}if ($str ~~ @arr) {...}
  • 78. Matchingif ($x ~~ $y) {...}if ($str ~~ %hash) {...}if ($str ~~ @arr) {...}if ($str ~~ [ %h, ...]) {...}
  • 79. Matchingif ($x ~~ $y) {...}if ($str ~~ %hash) {...}if ($str ~~ @arr) {...}if ($str ~~ [ %h, ...]) {...}if (%hash ~~ %h) {...}
  • 80. Matchingif ($x ~~ $y) {...}if ($str ~~ %hash) {...}if ($str ~~ @arr) {...}if ($str ~~ [ %h, ...]) {...}if (%hash ~~ %h) {...}if (%hash ~~ @arr) {...}
  • 81. Matchingif ($x ~~ $y) {...}if ($str ~~ %hash) {...}if ($str ~~ @arr) {...}if ($str ~~ [ %h, ...]) {...}if (%hash ~~ %h) {...}if (%hash ~~ @arr) {...}if (%hash ~~ [ %h,...]) {...}
  • 82. given ($x) { when ($y) { ... } when ($z) { ... }}
  • 83. given ($x) { when ($y) { try { ... } catch { warn “error: $_”; return undef; } }}
  • 84. each @array
  • 85. each @arraywhile (my ($i, $v) = each @array) { say “$i: $v”;}
  • 86. push $aref, @etc;
  • 87. Now With Fewer Bugs!
  • 88. y2038
  • 89. ~$ perl5.10.0 -E ‘say scalar localtime 2**31-1’
  • 90. ~$ perl5.10.0 -E ‘say scalar localtime 2**31-1’Mon Jan 18 22:14:07 2038
  • 91. ~$ perl5.10.0 -E ‘say scalar localtime 2**31-1’Mon Jan 18 22:14:07 2038~$ perl5.10.0 -E ‘say scalar localtime 2**31’
  • 92. ~$ perl5.10.0 -E ‘say scalar localtime 2**31-1’Mon Jan 18 22:14:07 2038~$ perl5.10.0 -E ‘say scalar localtime 2**31’Fri Dec 13 15:45:52 1901
  • 93. ~$ perl5.12.0 -E ‘say scalar localtime 2**31-1’
  • 94. ~$ perl5.12.0 -E ‘say scalar localtime 2**31-1’Mon Jan 18 22:14:07 2038
  • 95. ~$ perl5.12.0 -E ‘say scalar localtime 2**31-1’Mon Jan 18 22:14:07 2038~$ perl5.12.0 -E ‘say scalar localtime 2**31’
  • 96. ~$ perl5.12.0 -E ‘say scalar localtime 2**31-1’Mon Jan 18 22:14:07 2038~$ perl5.12.0 -E ‘say scalar localtime 2**31’Mon Jan 18 22:14:08 2038
  • 97. $@ perlvar
  • 98. $@ Try::Tiny
  • 99. $@- Well, actually, you use Try::Tiny, right? Try::Tiny
  • 100. $@- Well, actually, you use Try::Tiny, right?- But this makes Try::Tiny more reliable, too! Try::Tiny
  • 101. $@- Well, actually, you use Try::Tiny, right?- But this makes Try::Tiny more reliable, too!- You see, eval and $@ are totally awful Try::Tiny
  • 102. use 5.12.0;{ package X; sub DESTROY { eval { } }}eval { my $x = bless {} => ‘X’; die “DEATH!!”;};warn “ERROR: $@”; perlfunc
  • 103. use 5.12.0;{ package X; sub DESTROY { eval { } }}eval { my $x = bless {} => ‘X’; die “DEATH!!”;};warn “ERROR: $@”;$ perl5.12.4 test.plERROR: perlfunc
  • 104. use 5.14.0;{ package X; sub DESTROY { eval { } }}eval { my $x = bless {} => ‘X’; die “DEATH!!”;};warn “ERROR: $@”; perlfunc
  • 105. use 5.14.0;{ package X; sub DESTROY { eval { } }}eval { my $x = bless {} => ‘X’; die “DEATH!!”;};warn “ERROR: $@”;$ perl5.14.1 test.plERROR: DEATH!! perlfunc
  • 106. perl -le ‘print $^X’
  • 107. perl -le ‘print $^X’10.0: perl
  • 108. perl -le ‘print $^X’10.0: perl10.1: perl
  • 109. perl -le ‘print $^X’10.0: perl10.1: perl12.0: perl
  • 110. perl -le ‘print $^X’10.0: perl10.1: perl12.0: perl14.0: perl
  • 111. perl -le ‘print $^X’10.0: perl10.1: perl12.0: perl14.0: perl16.0: /Users/rjbs/perl5/perlbrew/perls/16.0/bin/perl
  • 112. Simpler Strings
  • 113. Perl is Good at Unicode perlunicode
  • 114. Perl 5.16 is Better perlunicode
  • 115. Perl 5.16 is Better- Unicode 6.1 perlunicode
  • 116. Perl 5.16 is Better- Unicode 6.1- every character property is available perlunicode
  • 117. Perl 5.16 is Better- Unicode 6.1- every character property is available- X in regex is more sensible perlunicode
  • 118. “The Unicode Bug” perlunicode
  • 119. “The Unicode Bug”- strings aren’t always treated as Unicode perlunicode
  • 120. “The Unicode Bug”- strings aren’t always treated as Unicode- this causes weird bugs that take ages to find perlunicode
  • 121. “The Unicode Bug”- strings aren’t always treated as Unicode- this causes weird bugs that take ages to find- use feature ‘unicode_strings’; perlunicode
  • 122. “The Unicode Bug”- strings aren’t always treated as Unicode- this causes weird bugs that take ages to find- use feature ‘unicode_strings’;- or use 5.12.0 perlunicode
  • 123. Unicode eval- eval $str- is that octets or chars?- what if it includes "use utf8"- or youre under "use utf8"? perldoc
  • 124. Unicode eval- evalbytes $str- unicode_eval perldoc
  • 125. My Favorite 5.12-ism?if (length $input->{new_email}) { $user->update_email(...);} perldiag
  • 126. My Favorite 5.12-ism?if (length $input->{new_email}) { $user->update_email(...);}Use of uninitialized value in lengthat - line 3120. perldiag
  • 127. My Favorite 5.12-ism?if (length $input->{new_email}) { $user->update_email(...);} perldiag
  • 128. say “I o{23145} Perl 5.14!”; perlsyn
  • 129. say “I o{23145} Perl 5.14!”;I ♥ Perl 5.14! perlsyn
  • 130. say “I 23145 Perl 5.14!”;I ?45 Perl 5.14! perlsyn
  • 131. say “I 023145 Perl 5.14!”;I 145 Perl 5.14! perlsyn
  • 132. qr{ (1) (2) (3) (4) 7 10 (5) (6) (7) (8) (9) 7 10 (10) 7 10}x; perlre
  • 133. qr{ (1) (2) (3) (4) o{7} o{10} (5) (6) (7) (8) (9) o{7} o{10} (10) g{7} g{10}}x; perlre
  • 134. Unicode 6.1 charnames
  • 135. Unicode 6.1 charnames
  • 136. Unicode 6 charnames
  • 137. Unicode 6 charnames
  • 138. Unicode 6 charnames
  • 139. Unicode 6 charnames
  • 140. Unicode 6 charnames
  • 141. Unicode 6 charnames
  • 142. Unicode 6 charnames
  • 143. Unicode 6 charnames
  • 144. Unicode 6 charnames
  • 145. N{...}use 5.16.0;say “I N{HEAVY BLACK HEART} Queensr” . “N{LATIN SMALL LETTER Y WITH DIAERESIS}” . “che!”;
  • 146. case folding
  • 147. Case Foldingif (lc $foo eq lc $bar) { ...}
  • 148. Case Foldingif (fc $foo eq fc $bar) { ...}
  • 149. Case Folding
  • 150. Case Foldinglc ‘ς‘ ➔ ‘ς‘
  • 151. Case Foldinglc ‘ς‘ ➔ ‘ς‘uc ‘ς‘ ➔ ‘Σ‘
  • 152. Case Foldinglc ‘ς‘ ➔ ‘ς‘uc ‘ς‘ ➔ ‘Σ‘fc ‘ς‘ ➔ ‘σ‘
  • 153. Case Foldinglc ‘ς‘ ➔ ‘ς‘uc ‘ς‘ ➔ ‘Σ‘fc ‘ς‘ ➔ ‘σ‘lc ‘ß’ ➔ ‘ß’
  • 154. Case Foldinglc ‘ς‘ ➔ ‘ς‘uc ‘ς‘ ➔ ‘Σ‘fc ‘ς‘ ➔ ‘σ‘lc ‘ß’ ➔ ‘ß’uc ‘ß’ ➔ ‘SS’
  • 155. Case Foldinglc ‘ς‘ ➔ ‘ς‘uc ‘ς‘ ➔ ‘Σ‘fc ‘ς‘ ➔ ‘σ‘lc ‘ß’ ➔ ‘ß’uc ‘ß’ ➔ ‘SS’fc ‘ß’ ➔ ‘ss’
  • 156. Case Folding
  • 157. Case Folding“file under: L$name”
  • 158. Case Folding“file under: L$name”“file under: F$name”
  • 159. Better Regex
  • 160. named captures
  • 161. Regex: Named Captures perlre
  • 162. Regex: Named Captures- find matches by name, not position perlre
  • 163. Regex: Named Captures- find matches by name, not position- avoid the dreaded$1 perlre
  • 164. Regex: Named Captures- find matches by name, not position- avoid the dreaded $1- no longer second to Python or .Net! perlre
  • 165. Regex: Named Captures# our hypothetical formatsection:property = value perlre
  • 166. Regex: Named Captures$line =~ /(w+):(w+) = (w+)/;$section = $1$name = $2;$value = $3; perlre
  • 167. Regex: Named Captures$line =~ / (?<section> w+): (?<name> w+) s* = s* (?<value> w+)/x;$section = $+{section};$name = $+{name};$value = $+{value}; perlre
  • 168. New Regex Modifiersmy $hostname = get_hostname;$hostname =~ s/..*//; perlre
  • 169. New Regex Modifiersmy $hostname = get_hostname =~ s/..*//; perlre
  • 170. New Regex Modifiers(my $hostname = get_hostname) =~ s/..*//; perlre
  • 171. New Regex Modifiersmy $hostname = get_hostname =~ s/..*//r; perlre
  • 172. New Regex Modifiersmy @short_names = map { s/..*//; } @long_names; perlre
  • 173. New Regex Modifiersmy @short_names = map { s/..*//; $_ } @long_names; perlre
  • 174. New Regex Modifiersmy @short_names = map { my $x = $_; $x =~ s/..*//; $x } @long_names; perlre
  • 175. New Regex Modifiersmy @short_names = map { s/..*//r } @long_names; perlre
  • 176. New Regex Modifiersmy @short_names = map s/..*//r, @long_names; perlre
  • 177. New Regex Modifiers perldoc
  • 178. New Regex Modifiers /u /a /aa /d /l"൮" =~ /d/ ✓ ! ! ¿? ¿?"ð" =~ /w/ ✓ ! ! ¿? ¿?"ff" =~ /ff/i ✓ ✓ ! ¿? ¿?"ff" =~ /pL/i ✓ ✓ ✓ ¿? ¿? perldoc
  • 179. New Regex Modifiers /u /a /aa /d /l"൮" =~ /d/ ✓ ! ! ¿? ¿?"ð" =~ /w/ ✓ ! ! ¿? ¿?"ff" =~ /ff/i ✓ ✓ ! ¿? ¿?"ff" =~ /pL/i ✓ ✓ ✓ ¿? ¿? perldoc
  • 180. New Regex Modifiers /u /a /aa /d /l"൮" =~ /d/ ✓ ! ! ¿? ¿?"ð" =~ /w/ ✓ ! ! ¿? ¿?"ff" =~ /ff/i ✓ ✓ ! ¿? ¿?"ff" =~ /pL/i ✓ ✓ ✓ ¿? ¿? perldoc
  • 181. New Regex Modifiers /u /a /aa /d /l"൮" =~ /d/ ✓ ! ! ¿? ¿?"ð" =~ /w/ ✓ ! ! ¿? ¿?"ff" =~ /ff/i ✓ ✓ ! ¿? ¿?"ff" =~ /pL/i ✓ ✓ ✓ ¿? ¿? perldoc
  • 182. New Regex Modifiers /u /a /aa /d /l"൮" =~ /d/ ✓ ! ! ¿? ¿?"ð" =~ /w/ ✓ ! ! ¿? ¿?"ff" =~ /ff/i ✓ ✓ ! ¿? ¿?"ff" =~ /pL/i ✓ ✓ ✓ ¿? ¿? perldoc
  • 183. New Regex Modifiers /u /a /aa /d /l"൮" =~ /d/ ✓ ! ! ¿? ¿?"ð" =~ /w/ ✓ ! ! ¿? ¿?"ff" =~ /ff/i ✓ ✓ ! ¿? ¿?"ff" =~ /pL/i ✓ ✓ ✓ ¿? ¿? perldoc
  • 184. New Regex Modifiers# To be really ASCII-only:die “funny un-American characters” if $str =~ /P{ASCII}/;$str =~ /...actual pattern.../; perlre
  • 185. study
  • 186. studymy $re = qr{...complex...};
  • 187. studymy $re = qr{...complex...};my $str = q{...long complex...};
  • 188. studymy $re = qr{...complex...};my $str = q{...long complex...};$str =~ $re; # slow!!
  • 189. studymy $re = qr{...complex...};my $str = q{...long complex...};$str =~ $re; # slow!!study $str; # does stuff
  • 190. studymy $re = qr{...complex...};my $str = q{...long complex...};$str =~ $re; # slow!!study $str; # does stuff$str =~ $re; # fast!!
  • 191. studymy $re = qr{...complex...};my $str = q{...long complex...};$str =~ $re; # slow but right!!study $str; # does stuff$str =~ $re; # who knows!!
  • 192. studymy $re = qr{...complex...};my $str = q{...long complex...};$str =~ $re; # slow but right!!study $str; # does nothing$str =~ $re; # slow but right!!
  • 193. Modder Modlib
  • 194. Newly Cored Librarys- JSON- HTTP::Tiny- Module::Metadata- CPAN::Meta perlmodlib
  • 195. Newly Ejected Librarys- Devel::DProf- Switch- the perl4 core- ...and more perlmodlib
  • 196. Old Stuff Removed
  • 197. qw()for my $show qw(Smallville Lost V) { $tivo->cancel_pass( $show );} perlop
  • 198. qw()for my $show (qw(Smallville Lost V)) { $tivo->cancel_pass( $show );} perlop
  • 199. $[
  • 200. $[ - first index of array perlvar
  • 201. $[ - first index of array - so you can make $array[1] mean first perlvar
  • 202. $[ - first index of array - so you can make $array[1] mean first - isn’t that awesome??? perlvar
  • 203. $[ - first index of array - so you can make $array[1] mean first - isn’t that awesome??? - yeah, about as awesome as Comic Sans perlvar
  • 204. $[$[ = 1;for (1 .. $#array) { ...} perlvar
  • 205. $[for ($[ .. $#array) { ...} perlvar
  • 206. $[Assigned to $[. Are you some kind ofidiot or something? at -e line 123. perlvar
  • 207. $[Use of assignment to $[ is deprecatedat -e line 123. perlvar
  • 208. defined @arr
  • 209. Any questions?
  • 210. Thank you!

×