require filename require num require package
Asserts a dependency of some kind depending on its argument.
(If an argument is not supplied, $_
is used.)
If the argument is a string filename, this function includes and
executes the Perl code
found in the separate file of that name. This is similar
to performing an eval
on the contents of the
file, except that require
checks to see that
the library file has not been included already.
The function also knows how to search the include path stored in the @INC
array.
If require
s argument is a number num, the
version number of the currently executing Perl binary
(as known by $]
) is compared to num, and if
smaller, execution is immediately aborted. Thus, a script that requires Perl
version 5.003 can have as its first line:
and earlier versions of Perl will abort.require 5.003;
If require
s argument is a package name,
require
assumes an automatic .pm suffix,
making it easy to load standard modules. This is like use
, except that
it happens at runtime, not compile time,
and the import
routine is not called.