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

NAME

6       experimental - Experimental features made easy
7

VERSION

9       version 0.025
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       •   "declared_refs" - enables aliasing via assignment to references
58
59           This was added in perl 5.26.0.
60
61       •   "isa" - allow the use of the "isa" infix operator
62
63           This was added in perl 5.32.0.
64
65       •   "lexical_topic" - allow the use of lexical $_ via "my $_".
66
67           This was added in perl 5.10.0 and removed in perl 5.23.4.
68
69       •   "lexical_subs" - allow the use of lexical subroutines.
70
71           This was added in 5.18.0.
72
73       •   "postderef" - allow the use of postfix dereferencing expressions
74
75           This was added in perl 5.20.0, and became non-experimental (and
76           always enabled) in 5.24.0.
77
78       •   "postderef_qq" - allow the use of postfix dereferencing expressions
79           inside interpolating strings
80
81           This was added in perl 5.20.0, and became non-experimental (and
82           always enabled) in 5.24.0.
83
84       •   "re_strict" - enables strict mode in regular expressions
85
86           This was added in perl 5.22.0.
87
88       •   "refaliasing" - allow aliasing via "\$x = \$y"
89
90           This was added in perl 5.22.0.
91
92       •   "regex_sets" - allow extended bracketed character classes in
93           regexps
94
95           This was added in perl 5.18.0.
96
97       •   "signatures" - allow subroutine signatures (for named arguments)
98
99           This was added in perl 5.20.0.
100
101       •   "smartmatch" - allow the use of "~~"
102
103           This was added in perl 5.10.0, but it should be noted there are
104           significant incompatibilities between 5.10.0 and 5.10.1.
105
106       •   "switch" - allow the use of "~~", given, and when
107
108           This was added in perl 5.10.0.
109
110       •   "try" - allow the use of "try" and "catch"
111
112           This was added in perl 5.34.0
113
114       •   "win32_perlio" - allows the use of the :win32 IO layer.
115
116           This was added on perl 5.22.0.
117
118   Ordering matters
119       Using this pragma to 'enable an experimental feature' is another way of
120       saying that this pragma will disable the warnings which would result
121       from using that feature.  Therefore, the order in which pragmas are
122       applied is important.  In particular, you probably want to enable
123       experimental features after you enable warnings:
124
125         use warnings;
126         use experimental 'smartmatch';
127
128       You also need to take care with modules that enable warnings for you.
129       A common example being Moose.  In this example, warnings for the
130       'smartmatch' feature are first turned on by the warnings pragma, off by
131       the experimental pragma and back on again by the Moose module (fix is
132       to switch the last two lines):
133
134         use warnings;
135         use experimental 'smartmatch';
136         use Moose;
137
138   Disclaimer
139       Because of the nature of the features it enables, forward compatibility
140       can not be guaranteed in any way.
141

SEE ALSO

143       perlexperiment contains more information about experimental features.
144

AUTHOR

146       Leon Timmermans <leont@cpan.org>
147
149       This software is copyright (c) 2013 by Leon Timmermans.
150
151       This is free software; you can redistribute it and/or modify it under
152       the same terms as the Perl 5 programming language system itself.
153
154
155
156perl v5.34.0                      2021-08-02                   experimental(3)
Impressum