I've seen several posts that state use 5.12.0;
in Perl enables certain features/pragmas by default (e.g., use strict;
). Another example is in UTF-8 and perl where it is stated that use 5.14.0;
is
optimal for Unicode string feature UTF-8 handling.
I seem to recall an available use
declaration that provides certain defaults (e.g., use strict; use warnings; use diagnostics;
), but can't remember the specifics. How does one find out what is included in a given use 5.##.#;
statement? For example, what does use 5.22.0;
provide by default? use strict;
?
This is documented in perldoc feature
:
It's possible to load multiple features together, using a feature bundle. The name of a feature bundle is prefixed with a colon, to distinguish it from an actual feature.
use feature ":5.10";
The following feature bundles are available:
bundle features included --------- ----------------- :default array_base :5.10 say state switch array_base :5.12 say state switch unicode_strings array_base :5.14 say state switch unicode_strings array_base :5.16 say state switch unicode_strings unicode_eval evalbytes current_sub fc :5.18 say state switch unicode_strings unicode_eval evalbytes current_sub fc :5.20 say state switch unicode_strings unicode_eval evalbytes current_sub fc :5.22 say state switch unicode_strings unicode_eval evalbytes current_sub fc
where
use v5.10.0;
will do an implicit
no feature ':all'; use feature ':5.10';
and so on.
Automatic enabling of strictures is documented in perldoc -f use
:
if the specified Perl version is greater than or equal to 5.12.0, strictures are enabled lexically as with
use strict
.
use 5.12.0;
does use feature ':5.12';
, so you get
The feature bundles are documented in feature.pm's documentation.
For enhancements not covered by feature, you can use Syntax::Construct.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With