Packages and modules

Download perl eBook

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

Related Examples

Stats

131 Contributors: 8
Tuesday, June 13, 2017
Licensed under: CC-BY-SA

Not affiliated with Stack Overflow
Rip Tutorial: info@zzzprojects.com

Download eBook