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

NAME

6       experimental - Experimental features made easy
7

VERSION

9       version 0.031
10

SYNOPSIS

12        use experimental 'lexical_subs', 'signatures';
13        my sub plus_one($value) { $value + 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       •   "args_array_with_signatures" - allow @_ to be used in signatured
40           subs.
41
42           This is supported on perl 5.20.0 and above, but is likely to be
43           removed in the future.
44
45       •   "array_base" - allow the use of $[ to change the starting index of
46           @array.
47
48           This was removed in perl 5.30.0.
49
50       •   "autoderef" - allow push, each, keys, and other built-ins on
51           references.
52
53           This was added in perl 5.14.0 and removed in perl 5.24.0.
54
55       •   "bitwise" - allow the new stringwise bit operators
56
57           This was added in perl 5.22.0.
58
59       •   "builtin" - allow the use of the functions in the builtin::
60           namespace
61
62           This was added in perl 5.36.0
63
64       •   "const_attr" - allow the :const attribute on subs
65
66           This was added in perl 5.22.0.
67
68       •   "declared_refs" - enables aliasing via assignment to references
69
70           This was added in perl 5.26.0.
71
72       •   "defer" - enables the use of defer blocks
73
74           This was added in perl 5.36.0
75
76       •   "extra_paired_delimiters" - enables the use of more paired string
77           delimiters than the traditional four, "<  >", "( )", "{ }", and
78           "[ ]".
79
80           This was added in perl 5.36.
81
82       •   "for_list" - allows iterating over multiple values at a time with
83           "for"
84
85           This was added in perl 5.36.0
86
87       •   "isa" - allow the use of the "isa" infix operator
88
89           This was added in perl 5.32.0.
90
91       •   "lexical_topic" - allow the use of lexical $_ via "my $_".
92
93           This was added in perl 5.10.0 and removed in perl 5.24.0.
94
95       •   "lexical_subs" - allow the use of lexical subroutines.
96
97           This was added in 5.18.0, and became non-experimental (and always
98           enabled) in 5.26.0.
99
100       •   "postderef" - allow the use of postfix dereferencing expressions
101
102           This was added in perl 5.20.0, and became non-experimental (and
103           always enabled) in 5.24.0.
104
105       •   "postderef_qq" - allow the use of postfix dereferencing expressions
106           inside interpolating strings
107
108           This was added in perl 5.20.0, and became non-experimental (and
109           always enabled) in 5.24.0.
110
111       •   "re_strict" - enables strict mode in regular expressions
112
113           This was added in perl 5.22.0.
114
115       •   "refaliasing" - allow aliasing via "\$x = \$y"
116
117           This was added in perl 5.22.0.
118
119       •   "regex_sets" - allow extended bracketed character classes in
120           regexps
121
122           This was added in perl 5.18.0.
123
124       •   "signatures" - allow subroutine signatures (for named arguments)
125
126           This was added in perl 5.20.0.
127
128       •   "smartmatch" - allow the use of "~~"
129
130           This was added in perl 5.10.0, but it should be noted there are
131           significant incompatibilities between 5.10.0 and 5.10.1.
132
133           The feature is going to be deprecated in perl 5.38.0, and removed
134           in 5.42.0.
135
136       •   "switch" - allow the use of "~~", given, and when
137
138           This was added in perl 5.10.0.
139
140           The feature is going to be deprecated in perl 5.38.0, and removed
141           in 5.42.0.
142
143       •   "try" - allow the use of "try" and "catch"
144
145           This was added in perl 5.34.0
146
147       •   "win32_perlio" - allows the use of the :win32 IO layer.
148
149           This was added on perl 5.22.0.
150
151   Ordering matters
152       Using this pragma to 'enable an experimental feature' is another way of
153       saying that this pragma will disable the warnings which would result
154       from using that feature.  Therefore, the order in which pragmas are
155       applied is important.  In particular, you probably want to enable
156       experimental features after you enable warnings:
157
158         use warnings;
159         use experimental 'smartmatch';
160
161       You also need to take care with modules that enable warnings for you.
162       A common example being Moose.  In this example, warnings for the
163       'smartmatch' feature are first turned on by the warnings pragma, off by
164       the experimental pragma and back on again by the Moose module (fix is
165       to switch the last two lines):
166
167         use warnings;
168         use experimental 'smartmatch';
169         use Moose;
170
171   Disclaimer
172       Because of the nature of the features it enables, forward compatibility
173       can not be guaranteed in any way.
174

SEE ALSO

176       perlexperiment contains more information about experimental features.
177

AUTHOR

179       Leon Timmermans <leont@cpan.org>
180
182       This software is copyright (c) 2013 by Leon Timmermans.
183
184       This is free software; you can redistribute it and/or modify it under
185       the same terms as the Perl 5 programming language system itself.
186
187
188
189perl v5.38.0                      2023-07-21                   experimental(3)
Impressum