Whats newin Perl 5.14
perldoc perlhist
5.10.02007−Dec−18
5.10 appearedat its 20th birthday
¿Are you using Perl >= 5.10?  — Ta k e p a rt in ou r su r ve y !
saywas introduced
¿Are you using     say      ?
Seriously
The New History  Began with
Modern Perl
Modern Perl
Modern Perl
Modern Perl termis often understood      too widely
But its just NOT these
Thats from a bookpublished in 2009
OK, go further:perldoc perlhist
well skip all odd (not even)  versions (5.11, 5.13) —      they are odd dev
5.12.02010−Apr−12
¿Are you using Perl >= 5.12?         — What i                    s YAPC?
5.14.0RC12011−Apr−20
RC — is arelease candidate
Then was RC2
And thenRC3
Well, Perl 6s wayis much longer
Perl 5.14is ready already
Whats newin Perl 5.14?
perldoc perldelta
perldelta == 5.14 – 5.12
NoticeAs described in perlpolicy, therelease of Perl 5.14.0 marks theofficial end of support for Perl5.10. Users of Perl 5....
Frankly speaking,its not that easy toupdate Perls versionon existing machine
Modules are themost difficult part
Do you know how to reinstalleverything easily?
New
1Syntax
2Security
Remember...
register_globals = off  $_GET["sql"]      In PHPsince version 4.2.0
Perl is secure  by itself
3Incompatibilities
4Deprecations
5Performance
6  Modulesand pragmas
7Documentation
8Diagnostics
9Utilities
10Install process
11Platforms
12Internals
13Bug fixes
14Опечатки
Well only take a look   at syntax andregular expressions       changes
(Well, its time toWelcome, Perl 6.0!)
Unicode affects bothstrings and regexes
A bell(fairy tale)
ASCII-character  BELL (0x7)
In Unicode 6.0BELL — 0x1F514
Panic!
Perl is calm and wise
Perl is calm and wise. . . probably
In PerlBELL	  =	  0x0007
In Perl  BELL	  =	  0x0007N{BELL}	  =	  0x0007
In Perl   BELL	  =	  0x0007N{BELL}	  =	  0x0007  0x0007	  =	  ALERT
BELL	  =	  0x0007N{BELL}	  =	  0x0007  0x0007	  =	  ALERT   ALERT	  =	  "a"
BELL	  =	  0x0007N{BELL}	  =	  0x0007  0x0007	  =	  ALERT   ALERT	  =	  "a"N{BEL}	  =	  0x0007
BELL	  =	  0x0007N{BELL}	  =	  0x0007  0x0007	  =	  ALERT   ALERT	  =	  "a"N{BEL}	  =	  0x0007 0x1F514	  —	  no name
0x0007	  =	  ALERT                 ALERT	  =	  "a"        N{BEL}	  =	  0x0007         0x1F514	  —	  no name              0...
0x1F514	  —	  no name              0x1F514	  =	  	  	  	  	  	  	  N{U+1F514}         Plans for Perl 5.16 N{BELL}	  =	  0x...
 	  	  	  	  	  N{U+1F514}         Plans for Perl 5.16  N{BELL}	  =	  0x1F514 replace existing N{BELL}      with	  N{ALERT...
use	  feature	  unicode_strings;
It brings the hope
That everything is in Unicode
How to turn 5.14 on
use v5.14;
use strict;   adds itselfbehind the scene
5.10.0          v5.10.0          v5.10vector stringversion stringabbreviated — v-string
Whats new inregular expressions
(?^	  .	  .	  .)
Switch off all themodifiers locally
"ABC"	  =~	  /abc/i;          True
"ABC"	  =~	  /a(?^:b)c/i;       False
"ABC"	  =~	  /a(?^i:b)c/i;       True
Ingenious reason
$	  perl5.14.0	  -­‐MData::Dumper	  -­‐Emy	  $x	  =	  qr/abc/;	  say	  Dumper($x)$VAR1	  =	  qr/(?^u:abc)/;          No ch...
$	  perl5.10.0	  -­‐MData::Dumper	  -­‐Emy	  $x	  =	  qr/abc/;	  say	  Dumper($x)$VAR1	  =	  qr/(?-­‐xism:abc)/;          ...
New modifiers
/l        ==use	  locale;
/u            ==    use	  feature	  unicode_strings;
/d           ~~    no	  locale;    no	  feature	  unicode_strings;
by lt  de fau           /d           ~~    no	  locale;    no	  feature	  unicode_strings;
/a
How many characters    match with       /d/
How many characters    match with       /d/     ±420
for	  (0x0	  ..	  0x10FFFF)	  {	  	  	  	  my	  $char	  =	  chr($_);	  	  	  	  say	  $char	  	  	  	  	  	  	  	  if	  $c...
/d/ matches any symbolmarked DIGIT in Unicode
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,٠ ٩ ,٨ ,٧ ,٦ ,٥ ,٤ ,٣ ,٢ ,١, ੦,੧, ੨, ੩, ੪, ੫, ੬, ੭, ੮, ੯, ૦, ૧,૨, ૩, ૪, ૫, ૬, ૭, ૮, ૯, ௦, ௧, ...
d becamea topic of arguments
/ds behaviour    is stable,but contradictory     d
Welcome  /a
for	  (0x0	  ..	  0x10FFFF)	  {	  	  	  	  my	  $char	  =	  chr($_);	  	  	  	  say	  $char	  	  	  	  	  	  	  	  if	  $c...
Only 10 ASCII     characters match$	  perl	  a1.pl	  |	  wc	  -­‐l10
/a creates ASCII versionsof the modifiers    d, s и w
And affects both   b and B
/r
Non-destructive substitution
A substitutionthat do not change  original string
use	  v5.14;my	  $version	  =	  "Perl	  5.10";say	  $version	  =~	  s/5.10/5.14/r;	  Result: Perl	  5.14
my $english = "colour";my $american =   $english =~ s/our/or/r;
Arrays and hashes
Extra noise chars to be removed
That featureis experimental
use	  v5.14;my	  $a	  =	  [];push	  $a,	  3,	  5,	  7;
use	  v5.10;my	  $a	  =	  [];push	  @$a,	  3,	  5,	  7;
(Likewise @a[1]    in Perl 6)
And more
push/pop	  @$arrayrefpush/pop	  $arrayref
shift/unshift	  @$arrayrefshift/unshift	  $arrayref
splice	  @$arrayrefsplice	  $arrayref
keys/values	  %$hashrefkeys/values	  $hashref
keys/values	  @$arrayrefkeys/values	  $arrayref
each	  %$href	  /	  @$aref each	  $href	  /	  $aref
given returns    the lastevaluated value
say	  mysub(7);sub	  mysub	  {	  	  	  	  given($_[0])	  {	   	  	  	  	  	  	  "few"	  	  when	  3;	   	  	  	  	  	  	  ...
(For those   who omitreturn keyword)
git blame
Aaron Crane, Abhijit Menon-Sen, Abigail, Ævar Arnfjörð Bjarmason, Alastair Douglas, AlexanderAlekseev, Alexander Hartmaier...
use v5.14 or die;
Or at least
use v5.14 or v5.12 ;-)
__END__Andrew Shitov   andy@shitov.ru
What's new in Perl 5.14
What's new in Perl 5.14
What's new in Perl 5.14
What's new in Perl 5.14
Upcoming SlideShare
Loading in...5
×

What's new in Perl 5.14

5,539

Published on

An overview of new features appeared in the version 5.14 of the Perl programming language.

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

No Downloads
Views
Total Views
5,539
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
32
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Transcript of "What's new in Perl 5.14"

  1. 1. Whats newin Perl 5.14
  2. 2. perldoc perlhist
  3. 3. 5.10.02007−Dec−18
  4. 4. 5.10 appearedat its 20th birthday
  5. 5. ¿Are you using Perl >= 5.10? — Ta k e p a rt in ou r su r ve y !
  6. 6. saywas introduced
  7. 7. ¿Are you using say ?
  8. 8. Seriously
  9. 9. The New History Began with
  10. 10. Modern Perl
  11. 11. Modern Perl
  12. 12. Modern Perl
  13. 13. Modern Perl termis often understood too widely
  14. 14. But its just NOT these
  15. 15. Thats from a bookpublished in 2009
  16. 16. OK, go further:perldoc perlhist
  17. 17. well skip all odd (not even) versions (5.11, 5.13) — they are odd dev
  18. 18. 5.12.02010−Apr−12
  19. 19. ¿Are you using Perl >= 5.12? — What i s YAPC?
  20. 20. 5.14.0RC12011−Apr−20
  21. 21. RC — is arelease candidate
  22. 22. Then was RC2
  23. 23. And thenRC3
  24. 24. Well, Perl 6s wayis much longer
  25. 25. Perl 5.14is ready already
  26. 26. Whats newin Perl 5.14?
  27. 27. perldoc perldelta
  28. 28. perldelta == 5.14 – 5.12
  29. 29. NoticeAs described in perlpolicy, therelease of Perl 5.14.0 marks theofficial end of support for Perl5.10. Users of Perl 5.10 or earliershould consider upgrading to amore recent release of Perl.
  30. 30. Frankly speaking,its not that easy toupdate Perls versionon existing machine
  31. 31. Modules are themost difficult part
  32. 32. Do you know how to reinstalleverything easily?
  33. 33. New
  34. 34. 1Syntax
  35. 35. 2Security
  36. 36. Remember...
  37. 37. register_globals = off $_GET["sql"] In PHPsince version 4.2.0
  38. 38. Perl is secure by itself
  39. 39. 3Incompatibilities
  40. 40. 4Deprecations
  41. 41. 5Performance
  42. 42. 6 Modulesand pragmas
  43. 43. 7Documentation
  44. 44. 8Diagnostics
  45. 45. 9Utilities
  46. 46. 10Install process
  47. 47. 11Platforms
  48. 48. 12Internals
  49. 49. 13Bug fixes
  50. 50. 14Опечатки
  51. 51. Well only take a look at syntax andregular expressions changes
  52. 52. (Well, its time toWelcome, Perl 6.0!)
  53. 53. Unicode affects bothstrings and regexes
  54. 54. A bell(fairy tale)
  55. 55. ASCII-character BELL (0x7)
  56. 56. In Unicode 6.0BELL — 0x1F514
  57. 57. Panic!
  58. 58. Perl is calm and wise
  59. 59. Perl is calm and wise. . . probably
  60. 60. In PerlBELL  =  0x0007
  61. 61. In Perl BELL  =  0x0007N{BELL}  =  0x0007
  62. 62. In Perl BELL  =  0x0007N{BELL}  =  0x0007 0x0007  =  ALERT
  63. 63. BELL  =  0x0007N{BELL}  =  0x0007 0x0007  =  ALERT ALERT  =  "a"
  64. 64. BELL  =  0x0007N{BELL}  =  0x0007 0x0007  =  ALERT ALERT  =  "a"N{BEL}  =  0x0007
  65. 65. BELL  =  0x0007N{BELL}  =  0x0007 0x0007  =  ALERT ALERT  =  "a"N{BEL}  =  0x0007 0x1F514  —  no name
  66. 66. 0x0007  =  ALERT ALERT  =  "a" N{BEL}  =  0x0007 0x1F514  —  no name 0x1F514  =              N{U+1F514}
  67. 67. 0x1F514  —  no name 0x1F514  =              N{U+1F514} Plans for Perl 5.16 N{BELL}  =  0x1F514
  68. 68.            N{U+1F514} Plans for Perl 5.16 N{BELL}  =  0x1F514 replace existing N{BELL} with  N{ALERT}, N{BEL}  or  "a"
  69. 69. use  feature  unicode_strings;
  70. 70. It brings the hope
  71. 71. That everything is in Unicode
  72. 72. How to turn 5.14 on
  73. 73. use v5.14;
  74. 74. use strict; adds itselfbehind the scene
  75. 75. 5.10.0 v5.10.0 v5.10vector stringversion stringabbreviated — v-string
  76. 76. Whats new inregular expressions
  77. 77. (?^  .  .  .)
  78. 78. Switch off all themodifiers locally
  79. 79. "ABC"  =~  /abc/i; True
  80. 80. "ABC"  =~  /a(?^:b)c/i; False
  81. 81. "ABC"  =~  /a(?^i:b)c/i; True
  82. 82. Ingenious reason
  83. 83. $  perl5.14.0  -­‐MData::Dumper  -­‐Emy  $x  =  qr/abc/;  say  Dumper($x)$VAR1  =  qr/(?^u:abc)/; No changes after adding new modifiers to Perl
  84. 84. $  perl5.10.0  -­‐MData::Dumper  -­‐Emy  $x  =  qr/abc/;  say  Dumper($x)$VAR1  =  qr/(?-­‐xism:abc)/; Will be changed after adding new modifiers to Perl
  85. 85. New modifiers
  86. 86. /l ==use  locale;
  87. 87. /u == use  feature  unicode_strings;
  88. 88. /d ~~ no  locale; no  feature  unicode_strings;
  89. 89. by lt de fau /d ~~ no  locale; no  feature  unicode_strings;
  90. 90. /a
  91. 91. How many characters match with /d/
  92. 92. How many characters match with /d/ ±420
  93. 93. for  (0x0  ..  0x10FFFF)  {        my  $char  =  chr($_);        say  $char                if  $char  =~  /^d$/;}
  94. 94. /d/ matches any symbolmarked DIGIT in Unicode
  95. 95. 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,٠ ٩ ,٨ ,٧ ,٦ ,٥ ,٤ ,٣ ,٢ ,١, ੦,੧, ੨, ੩, ੪, ੫, ੬, ੭, ੮, ੯, ૦, ૧,૨, ૩, ૪, ૫, ૬, ૭, ૮, ૯, ௦, ௧, ௨, ௩, ௪, ௫, ௬, ௭, ௮, ௯, ...
  96. 96. d becamea topic of arguments
  97. 97. /ds behaviour is stable,but contradictory d
  98. 98. Welcome /a
  99. 99. for  (0x0  ..  0x10FFFF)  {        my  $char  =  chr($_);        say  $char                if  $char  =~  /^d$/a;}
  100. 100. Only 10 ASCII characters match$  perl  a1.pl  |  wc  -­‐l10
  101. 101. /a creates ASCII versionsof the modifiers d, s и w
  102. 102. And affects both b and B
  103. 103. /r
  104. 104. Non-destructive substitution
  105. 105. A substitutionthat do not change original string
  106. 106. use  v5.14;my  $version  =  "Perl  5.10";say  $version  =~  s/5.10/5.14/r;  Result: Perl  5.14
  107. 107. my $english = "colour";my $american = $english =~ s/our/or/r;
  108. 108. Arrays and hashes
  109. 109. Extra noise chars to be removed
  110. 110. That featureis experimental
  111. 111. use  v5.14;my  $a  =  [];push  $a,  3,  5,  7;
  112. 112. use  v5.10;my  $a  =  [];push  @$a,  3,  5,  7;
  113. 113. (Likewise @a[1] in Perl 6)
  114. 114. And more
  115. 115. push/pop  @$arrayrefpush/pop  $arrayref
  116. 116. shift/unshift  @$arrayrefshift/unshift  $arrayref
  117. 117. splice  @$arrayrefsplice  $arrayref
  118. 118. keys/values  %$hashrefkeys/values  $hashref
  119. 119. keys/values  @$arrayrefkeys/values  $arrayref
  120. 120. each  %$href  /  @$aref each  $href  /  $aref
  121. 121. given returns the lastevaluated value
  122. 122. say  mysub(7);sub  mysub  {        given($_[0])  {              "few"    when  3;              "OK"      when  5;              "many"  when  7;              "?";        }}
  123. 123. (For those who omitreturn keyword)
  124. 124. git blame
  125. 125. Aaron Crane, Abhijit Menon-Sen, Abigail, Ævar Arnfjörð Bjarmason, Alastair Douglas, AlexanderAlekseev, Alexander Hartmaier, Alexandr Ciornii, Alex Davies, Alex Vandiver, Ali Polatel, Allen Smith,Andreas König, Andrew Rodland, Andy Armstrong, Andy Dougherty, Aristotle Pagaltzis, Arkturuz,Arvan, A. Sinan Unur, Ben Morrow, Bo Lindbergh, Boris Ratner, Brad Gilbert, Bram, brian d foy, BrianPhillips, Casey West, Charles Bailey, Chas. Owens, Chip Salzenberg, Chris BinGOs Williams,chromatic, Craig A. Berry, Curtis Jewell, Dagfinn Ilmari Mannsåker, Dan Dascalescu, Dave Rolsky,David Caldwell, David Cantrell, David Golden, David Leadbeater, David Mitchell, David Wheeler, EricBrine, Father Chrysostomos, Fingle Nark, Florian Ragwitz, Frank Wiegand, Franz Fasching, GeneSullivan, George Greer, Gerard Goossen, Gisle Aas, Goro Fuji, Grant McLean, gregor herrmann,H.Merijn Brand, Hongwen Qiu, Hugo van der Sanden, Ian Goodacre, James E Keenan, James Mastros,Jan Dubois, Jay Hannah, Jerry D. Hedden, Jesse Vincent, Jim Cromie, Jirka Hruška, John Peacock,Joshua ben Jore, Joshua Pritikin, Karl Williamson, Kevin Ryde, kmx, Lars Dɪᴇᴄᴋᴏᴡ , LarwanBerke, Leon Brocard, Leon Timmermans, Lubomir Rintel, Lukas Mai, Maik Hentsche, Marty Pauley,Marvin Humphrey, Matt Johnson, Matt S Trout, Max Maischein, Michael Breen, Michael Fig, Michael GSchwern, Michael Parker, Michael Stevens, Michael Witten, Mike Kelly, Moritz Lenz, Nicholas Clark,Nick Cleaton, Nick Johnston, Nicolas Kaiser, Niko Tyni, Noirin Shirley, Nuno Carvalho, Paul Evans,Paul Green, Paul Johnson, Paul Marquess, Peter J. Holzer, Peter John Acklam, Peter Martini, PhilippeBruhat (BooK), Piotr Fusik, Rafael Garcia-Suarez, Rainer Tammer, Reini Urban, Renee Baecker, RicardoSignes, Richard Möhn, Richard Soderberg, Rob Hoelz, Robin Barker, Ruslan Zakirov, Salvador Fandiño,Salvador Ortiz Garcia, Shlomi Fish, Sinan Unur, Sisyphus, Slaven Rezic, Steffen Müller, Steve Hay,Steven Schubiger, Steve Peters, Sullivan Beck, Tatsuhiko Miyagawa, Tim Bunce, Todd Rinaldo, TomChristiansen, Tom Hukins, Tony Cook, Tye McQueen, Vadim Konovalov, Vernon Lyon, Vincent Pit, WaltMankowski, Wolfram Humann, Yves Orton, Zefram и Zsbán Ambrus.
  126. 126. use v5.14 or die;
  127. 127. Or at least
  128. 128. use v5.14 or v5.12 ;-)
  129. 129. __END__Andrew Shitov andy@shitov.ru
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×