1experimental(3)       User Contributed Perl Documentation      experimental(3)
2
3
4

NAME

6       experimental - Experimental features made easy
7

VERSION

9       version 0.019
10

SYNOPSIS

12        use experimental 'lexical_subs', 'smartmatch';
13        my sub foo { $_[0] ~~ 1 }
14

DESCRIPTION

16       This pragma provides an easy and convenient way to enable or disable
17       experimental features.
18
19       Every version of perl has some number of features present but
20       considered "experimental."  For much of the life of Perl 5, this was
21       only a designation found in the documentation.  Starting in Perl
22       v5.10.0, and more aggressively in v5.18.0, experimental features were
23       placed behind pragmata used to enable the feature and disable
24       associated warnings.
25
26       The "experimental" pragma exists to combine the required incantations
27       into a single interface stable across releases of perl.  For every
28       experimental feature, this should enable the feature and silence
29       warnings for the enclosing lexical scope:
30
31         use experimental 'feature-name';
32
33       To disable the feature and, if applicable, re-enable any warnings, use:
34
35         no experimental 'feature-name';
36
37       The supported features, documented further below, are:
38
39       ·   "array_base" - allow the use of $[ to change the starting index of
40           @array.
41
42           This is supported on all versions of perl.
43
44       ·   "autoderef" - allow push, each, keys, and other built-ins on
45           references.
46
47           This was added in perl 5.14.0 and removed in perl 5.23.1.
48
49       ·   "bitwise" - allow the new stringwise bit operators
50
51           This was added in perl 5.22.0.
52
53       ·   "const_attr" - allow the :const attribute on subs
54
55           This was added in perl 5.22.0.
56
57       ·   "lexical_topic" - allow the use of lexical $_ via "my $_".
58
59           This was added in perl 5.10.0 and removed in perl 5.23.4.
60
61       ·   "lexical_subs" - allow the use of lexical subroutines.
62
63           This was added in 5.18.0.
64
65       ·   "postderef" - allow the use of postfix dereferencing expressions,
66           including in interpolating strings
67
68           This was added in perl 5.20.0.
69
70       ·   "re_strict" - enables strict mode in regular expressions
71
72           This was added in perl 5.22.0.
73
74       ·   "refaliasing" - allow aliasing via "\$x = \$y"
75
76           This was added in perl 5.22.0.
77
78       ·   "regex_sets" - allow extended bracketed character classes in
79           regexps
80
81           This was added in perl 5.18.0.
82
83       ·   "signatures" - allow subroutine signatures (for named arguments)
84
85           This was added in perl 5.20.0.
86
87       ·   "smartmatch" - allow the use of "~~"
88
89           This was added in perl 5.10.0, but it should be noted there are
90           significant incompatibilities between 5.10.0 and 5.10.1.
91
92       ·   "switch" - allow the use of "~~", given, and when
93
94           This was added in perl 5.10.0.
95
96       ·   "win32_perlio" - allows the use of the :win32 IO layer.
97
98           This was added on perl 5.22.0.
99
100   Ordering matters
101       Using this pragma to 'enable an experimental feature' is another way of
102       saying that this pragma will disable the warnings which would result
103       from using that feature.  Therefore, the order in which pragmas are
104       applied is important.  In particular, you probably want to enable
105       experimental features after you enable warnings:
106
107         use warnings;
108         use experimental 'smartmatch';
109
110       You also need to take care with modules that enable warnings for you.
111       A common example being Moose.  In this example, warnings for the
112       'smartmatch' feature are first turned on by the warnings pragma, off by
113       the experimental pragma and back on again by the Moose module (fix is
114       to switch the last two lines):
115
116         use warnings;
117         use experimental 'smartmatch';
118         use Moose;
119
120   Disclaimer
121       Because of the nature of the features it enables, forward compatibility
122       can not be guaranteed in any way.
123

SEE ALSO

125       perlexperimental contains more information about experimental features.
126

AUTHOR

128       Leon Timmermans <leont@cpan.org>
129
131       This software is copyright (c) 2013 by Leon Timmermans.
132
133       This is free software; you can redistribute it and/or modify it under
134       the same terms as the Perl 5 programming language system itself.
135
136
137
138perl v5.26.3                      2017-12-03                   experimental(3)
Impressum