@@ -53,14 +53,16 @@ formats, either as a floating-point number, or a v-string):
53
53
New versions of Perl come with bug fixes, speed improvements, deprecations
54
54
and also new features. It's still the same old Perl, that will continue
55
55
to run your existing code. Perl version upgrades are so simple and
56
- drama-less they're almost boring.
56
+ drama-less they're almost boring. (The Perl 5 Porters support the two
57
+ most recent stable releases of Perl, which should be reason enough to
58
+ upgrade your binary.)
57
59
58
60
Long story short, Perl is extremely backwards compatible. This means that
59
61
sensibly-written code from 20 years ago should still run under the
60
62
next release of Perl. In other words, any C<perl> interpreter should
61
63
understand code written against older versions of the Perl I<language>
62
64
just fine. As I have personally experimented, this actually even applies
63
- to scripts targetting the Perl 4 language!
65
+ to scripts targetting version 4 of the language!
64
66
65
67
With such a strong commitment to backwards compatibility, how does
66
68
one even introduce new features to the language? To quote from
@@ -101,7 +103,7 @@ Note that enabling features always happens in the current lexical scope.
101
103
=head3 The gift of choice
102
104
103
105
Backwards-compatibility is preserved thanks to a compromise: people have
104
- to I<opt- in> to the new features. The unfortunate side-effect is that
106
+ to I<opt in> to the new features. The unfortunate side-effect is that
105
107
Perl will continue to look the same (sometimes giving the feeling it's
106
108
stagnating) until you enable the new features!
107
109
@@ -112,7 +114,7 @@ many were. The L<Syntax::Construct> module has an exhaustive list of
112
114
"syntactic constructs that are not implemented via the C<feature> pragma,
113
115
but are still not compatible with older versions of Perl".
114
116
115
- Perl v5.40 knows about 25 features. While they could be enabled or
117
+ Perl v5.40 knows about 25 features. While they can be enabled or
116
118
disabled (some features are used to disable undesirable constructs,
117
119
like indirect object notation) one by one, there is a better way than
118
120
25 lines of boilerplate.
@@ -126,8 +128,8 @@ several operations:
126
128
127
129
The first thing that C<use VERSION> does is to declare which minimum
128
130
version of C<perl> (the interpreter) you expect to run your code. If you
129
- demand a version that is larger than that of the perl binary currently
130
- running your code, it's going to die at compile time.
131
+ demand a version later than that of the perl binary currently running
132
+ your code, it's going to die at compile time.
131
133
132
134
$ perl -Mv5.38 -e1
133
135
Perl v5.38.0 required--this is only v5.36.0, stopped.
@@ -154,16 +156,16 @@ corresponding feature bundle. For example:
154
156
155
157
=end perl
156
158
157
- is equivalent to :
159
+ will implicitly load the corresponding feature bundle :
158
160
159
161
=begin perl
160
162
161
163
use feature ':5.10';
162
164
163
165
=end perl
164
166
165
- and will enable the C<say>, C<state> and C<switch> features. The
166
- compiler will now understand the corresponding keywords, and behave
167
+ which will enable the C<say>, C<state> and C<switch> features. The
168
+ parser will now understand the corresponding keywords, and behave
167
169
accordingly. Error messages might differ a lot when a feature is
168
170
enabled or not.
169
171
@@ -177,7 +179,7 @@ will enable C<strict>, C<use v5.36> will enable C<warnings> and C<use
177
179
v5.40> will import L<builtin> functions (using a similar version bundle
178
180
scheme: see L<builtin/Version-Bundles>).
179
181
180
- Note that this is a lexical pragma, meaning that you could declare
182
+ Note that C<use VERSION> is a lexical pragma, meaning that you could declare
181
183
different version bundles for different parts of your code. For
182
184
consistency, it's really recommended that you pick one version, and
183
185
stick with it for the entire file. In fact, a future release of C<perl>
@@ -190,10 +192,11 @@ following two operations in a single line of code:
190
192
191
193
=head4 Enable modern Perl features
192
194
193
- Perl features are generally used to introduce experimental features
194
- without making them part of the "official" language. Features become
195
- official when they are included in a feature bundle. Failed experiments
196
- can be removed safely if they never come out of the experimental phase.
195
+ Before features become part of the "official" language, they are often
196
+ introduced as experiments. Experimental features are available only when
197
+ requested via C<use feature>, and aren't part of a bundle. In fact,
198
+ they'll even issue warnings when you use them. (See L<experimental>
199
+ for more about this.)
197
200
198
201
For example, the C<signatures> feature was introduced in C<perl> v5.20,
199
202
and remained experimental until v5.34. That meant that, as long as the
@@ -209,13 +212,13 @@ immediately added to the C<:5.38> feature bundle.
209
212
210
213
=head4 Deprecate discouraged features
211
214
212
- Bundles have also been used to deprecate and disable features that have
213
- become discouraged. These are made part of the C<:default> feature bundle,
215
+ Bundles have also been used to disable features that have become
216
+ discouraged. These are made part of the C<:default> feature bundle,
214
217
and not included in later bundles.
215
218
216
219
Doing it this way makes it possible to preserve the behaviour of
217
- ancient, unmaintained, scripts and modules. Even if they load some
218
- feature bundle (via C<use VERSION>), any deprecated feature they might
220
+ ancient, unmaintained scripts and modules. Even if they load some
221
+ feature bundle (via C<use VERSION>), any discouraged feature they might
219
222
use will also be (retroactively) included in that bundle, preserving
220
223
backward compatibitlity.
221
224
@@ -225,8 +228,9 @@ C<bareword_filehandles> came to be "removed" from later versions of Perl.
225
228
This is the strategy the L<Perl Steering Council|perlgov/The Steering Council>
226
229
has chosen to best stretch the language between the continuous
227
230
introduction of new features and the preservation of backwards
228
- compatibility. For the record, many Perl 4 (which is actually Perl 3,
229
- from late 1989) scripts still run fine with perl 5.40.
231
+ compatibility. For the record, many Perl 4 (which is functionally
232
+ identical to Perl 3, from late 1989) scripts still run fine with C<perl>
233
+ v5.40.
230
234
231
235
=head2 Why pick a Perl version?
232
236
@@ -277,26 +281,12 @@ It's of course possible to include experimental features, or re-enable
277
281
deprecated features (the latter is really not recommended), to fine-tune
278
282
the specific dialect of Perl in which the code is written.
279
283
280
- Always use a I<stable> version number with C<use VERSION>. The point is to
281
- I<declare> which version of the Perl I<language> your code is targetting.
282
-
283
284
Future versions of C<perl> implicitly promise that they will understand
284
285
the dialect of Perl declared by C<use VERSION>, and that they will run
285
286
it to the best of their abilities.
286
287
287
288
=head2 The Once and Future Perl
288
289
289
- Every year, a new version of C<perl> comes out. The C<perl> binary is
290
- updated, and so is the Perl language. The Perl 5 Porters support the
291
- two most recent stable releases of Perl, which gives you a good reason
292
- to upgrade your binary. You don't have to upgrade the version of the
293
- language your code uses, though.
294
-
295
- If you use Perl in 2024, you don't have to write code like the dot-com
296
- bubble is about to burst. (Be wary of the AI bubble, though...)
297
- You can easily signal your code was written in the last decade,
298
- and enjoy the recent evolutions of the language.
299
-
300
290
=head3 The new "use strict and warnings"
301
291
302
292
Since the time of "use strict and warnings" as minimum requirements for
0 commit comments