=over =item use Module VERSION LIST X X X =item use Module VERSION =item use Module LIST =item use Module =item use VERSION Imports some semantics into the current package from the named module, generally by aliasing certain subroutine or variable names into your package. It is exactly equivalent to BEGIN { require Module; Module->import( LIST ); } except that Module I be a bareword. The importation can be made conditional by using the L module. In the peculiar C form, VERSION may be either a positive decimal fraction such as 5.006, which will be compared to C<$]>, or a v-string of the form v5.6.1, which will be compared to C<$^V> (aka $PERL_VERSION). An exception is raised if VERSION is greater than the version of the current Perl interpreter; Perl will not attempt to parse the rest of the file. Compare with L, which can do a similar check at run time. Symmetrically, C allows you to specify that you want a version of Perl older than the specified one. Specifying VERSION as a literal of the form v5.6.1 should generally be avoided, because it leads to misleading error messages under earlier versions of Perl (that is, prior to 5.6.0) that do not support this syntax. The equivalent numeric version should be used instead. use v5.6.1; # compile time version check use 5.6.1; # ditto use 5.006_001; # ditto; preferred for backwards compatibility This is often useful if you need to check the current Perl version before Cing library modules that won't work with older versions of Perl. (We try not to do this more than we have to.) C also enables all features available in the requested version as defined by the C pragma, disabling any features not in the requested version's feature bundle. See L. Similarly, if the specified Perl version is greater than or equal to 5.12.0, strictures are enabled lexically as with C. Any explicit use of C or C overrides C, even if it comes before it. In both cases, the F and F files are not actually loaded. The C forces the C and C to happen at compile time. The C makes sure the module is loaded into memory if it hasn't been yet. The C is not a builtin; it's just an ordinary static method call into the C package to tell the module to import the list of features back into the current package. The module can implement its C method any way it likes, though most modules just choose to derive their C method via inheritance from the C class that is defined in the C module. See L. If no C method can be found then the call is skipped, even if there is an AUTOLOAD method. If you do not want to call the package's C method (for instance, to stop your namespace from being altered), explicitly supply the empty list: use Module (); That is exactly equivalent to BEGIN { require Module } If the VERSION argument is present between Module and LIST, then the C will call the VERSION method in class Module with the given version as an argument. The default VERSION method, inherited from the UNIVERSAL class, croaks if the given version is larger than the value of the variable C<$Module::VERSION>. Again, there is a distinction between omitting LIST (C called with no arguments) and an explicit empty LIST C<()> (C not called). Note that there is no comma after VERSION! Because this is a wide-open interface, pragmas (compiler directives) are also implemented this way. Currently implemented pragmas are: use constant; use diagnostics; use integer; use sigtrap qw(SEGV BUS); use strict qw(subs vars refs); use subs qw(afunc blurfl); use warnings qw(all); use sort qw(stable _quicksort _mergesort); Some of these pseudo-modules import semantics into the current block scope (like C or C, unlike ordinary modules, which import symbols into the current package (which are effective through the end of the file). Because C takes effect at compile time, it doesn't respect the ordinary flow control of the code being compiled. In particular, putting a C inside the false branch of a conditional doesn't prevent it from being processed. If a module or pragma only needs to be loaded conditionally, this can be done using the L pragma: use if $] < 5.008, "utf8"; use if WANT_WARNINGS, warnings => qw(all); There's a corresponding C declaration that unimports meanings imported by C, i.e., it calls C instead of C. It behaves just as C does with VERSION, an omitted or empty LIST, or no unimport method being found. no integer; no strict 'refs'; no warnings; Care should be taken when using the C form of C. It is I meant to be used to assert that the running Perl is of a earlier version than its argument and I to undo the feature-enabling side effects of C. See L for a list of standard modules and pragmas. See L for the C<-M> and C<-m> command-line options to Perl that give C functionality from the command-line. =back