From 6b443abb1ebf8f9a7902eb53911ab26201e5e7ab Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Mon, 26 Mar 2012 18:48:45 +0200 Subject: [PATCH] perl: initial overview of features per perl version --- perl.inc.pl | 38 ++++++++++++++++++++++++++++++++++++++ perl.plp | 25 +++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 perl.inc.pl create mode 100644 perl.plp diff --git a/perl.inc.pl b/perl.inc.pl new file mode 100644 index 0000000..30fe00c --- /dev/null +++ b/perl.inc.pl @@ -0,0 +1,38 @@ +use utf8; + ++{ + v5.6 => [ + ['use utf8'], + ['\N{named character}'], + ['our'], + ['v1.2.3'], + ['sub :locked :method'], + ['open $fh, $mode, $expr'], + ], + v5.8 => [ + ['unicode overhaul'], + ['PerlIO'], + ], + v5.10 => [ + ['//', 'defined-or operator'], + ['~~', 'smart-match operator to compare different data types'], + ['given', 'switch statement to smart-match with when/default'], + ['/(?)/ and $+{name}', 'named caputer buffers'], + ['s/keep\K//', 'floating positive lookbehind, efficient alternative for s/(keep)/$1/'], + ['/\v/, /\h/', 'vertical and horizontal whitespace escapes'], + ['my $_', 'lexically scoped version of the default variable'], + ], + v5.12 => [ + ['package version', 'package NAME VERSION shorthand for our $VERSION"'], + ['...', 'yada-yada operator: code placeholder'], + ['use strict', 'Implicit strictures if use VERSION >= 5.12'], + ['... when', '"when" is now allowed to be used as a statement modifier'], + ], + v5.14 => [ + ['s///r', 'non-destructive substitution'], + ['/(?^)/', 'construct to reset to default modifiers'], + ['/(?{ m// })/', 'regular expressions can be nested in /(?{})/ and /(??{})/'], + ["use re '/flags'", 'customize default modifiers'], + ['each $ref e.a.', 'array and hash container functions accept references'], + ], +} diff --git a/perl.plp b/perl.plp new file mode 100644 index 0000000..255032a --- /dev/null +++ b/perl.plp @@ -0,0 +1,25 @@ +<(common.inc.plp)><: + +Html({ + title => 'perl version cheat sheet', + version => 'v1.0', + keywords => [qw' + perl version feature features comparison + sheet cheat overview summary + '], + stylesheet => [qw'light dark red'], +}); + +:> +

Perl cheat sheets

+ +<: +my $info = do 'perl.inc.pl' or die $@ // $!; +for my $ver (reverse sort keys %{$info}) { + print '
'."\n"; + printf '

%vd

'."\n", $ver; + printf '
%s
%s', Entity(@{$_}), '
' for @{ $info->{$ver} }; + print "
\n"; + print "
\n\n"; +} + -- 2.30.0