require

requireVERSIONrequireEXPRrequire
This function asserts a dependency of some kind on its argument.
If the argument is a string, require loads and executes the Perl code found
in the separate file whose name is given by the string. This is similar
to using a do on a file, except that
require checks to see whether the
library file has been loaded already and raises an exception if any
difficulties are encountered. (It can thus be used to express file
dependencies without worrying about duplicate compilation.) Like its
cousins do and use, require knows how to search the include path
stored in the @INC array and to
update %INC on success. See Chapter 25.
The file must return true as the last value to indicate successful
execution of any initialization code, so it’s customary to end such a
file with 1 unless you’re sure it’ll
return true otherwise. (This requirement may be relaxed in the
future.)
If require’s argument is a
version number of the form v5.6.2, require demands that the currently executing version of Perl be at least that version. (Perl also accepts a floating-point number ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access