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

NAME

6       experimental - Experimental features made easy
7

VERSION

9       version 0.028
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_delims" - 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.
98
99       •   "postderef" - allow the use of postfix dereferencing expressions
100
101           This was added in perl 5.20.0, and became non-experimental (and
102           always enabled) in 5.24.0.
103
104       •   "postderef_qq" - allow the use of postfix dereferencing expressions
105           inside interpolating strings
106
107           This was added in perl 5.20.0, and became non-experimental (and
108           always enabled) in 5.24.0.
109
110       •   "re_strict" - enables strict mode in regular expressions
111
112           This was added in perl 5.22.0.
113
114       •   "refaliasing" - allow aliasing via "\$x = \$y"
115
116           This was added in perl 5.22.0.
117
118       •   "regex_sets" - allow extended bracketed character classes in
119           regexps
120
121           This was added in perl 5.18.0.
122
123       •   "signatures" - allow subroutine signatures (for named arguments)
124
125           This was added in perl 5.20.0.
126
127       •   "smartmatch" - allow the use of "~~"
128
129           This was added in perl 5.10.0, but it should be noted there are
130           significant incompatibilities between 5.10.0 and 5.10.1.
131
132       •   "switch" - allow the use of "~~", given, and when
133
134           This was added in perl 5.10.0.
135
136       •   "try" - allow the use of "try" and "catch"
137
138           This was added in perl 5.34.0
139
140       •   "win32_perlio" - allows the use of the :win32 IO layer.
141
142           This was added on perl 5.22.0.
143
144   Ordering matters
145       Using this pragma to 'enable an experimental feature' is another way of
146       saying that this pragma will disable the warnings which would result
147       from using that feature.  Therefore, the order in which pragmas are
148       applied is important.  In particular, you probably want to enable
149       experimental features after you enable warnings:
150
151         use warnings;
152         use experimental 'smartmatch';
153
154       You also need to take care with modules that enable warnings for you.
155       A common example being Moose.  In this example, warnings for the
156       'smartmatch' feature are first turned on by the warnings pragma, off by
157       the experimental pragma and back on again by the Moose module (fix is
158       to switch the last two lines):
159
160         use warnings;
161         use experimental 'smartmatch';
162         use Moose;
163
164   Disclaimer
165       Because of the nature of the features it enables, forward compatibility
166       can not be guaranteed in any way.
167

SEE ALSO

169       perlexperiment contains more information about experimental features.
170

AUTHOR

172       Leon Timmermans <leont@cpan.org>
173
175       This software is copyright (c) 2013 by Leon Timmermans.
176
177       This is free software; you can redistribute it and/or modify it under
178       the same terms as the Perl 5 programming language system itself.
179
180
181
182perl v5.36.0                      2022-07-22                   experimental(3)
Impressum