Perl Language Tutorial:

Perl Language Packages and modules

Syntax

  • require Module::Name; # Require by name from @INC
  • require "path/to/file.pm"; # Require by relative path from @INC
  • use Module::Name; # require and default import at BEGIN
  • use Module::Name (); # require and no import at BEGIN
  • use Module::Name (@ARGS); # require and import with args at BEGIN
  • use Module::Name VERSION; # require, version check, and default import at BEGIN
  • use Module::Name VERSION (); # require, version check, and no import at BEGIN
  • use Module::Name VERSION (@ARGS); # require, version check, import with args at BEGIN
  • do "path/to/file.pl"; # load and eval the given file

Perl Language Packages and modules Examples:

Related Perl Language Tutorial Topics:

Other Tutorial Topics:

This modified content is an extract of the original Stack Overflow Documentation released under CC BY-SA 3.0 This website is not affiliated with Stack Overflow. This topic was created and modified by the Stack Ovedrflow Contributor.