--- name: require status: documented runtime: pp source: src/runtime/pp/system.rs --- ```{index} single: require; Perl built-in (pp runtime) ``` # require ## Synopsis ```perl require 5.036; # version check require Carp; # load Carp.pm via @INC require "config.pl"; # load a file by path ``` ## Description Loads and executes a Perl file or module, caching it in `%INC` so that subsequent calls for the same module are no-ops. Behaviour depends on the argument type: 1. **Version number** (numeric or v-string): asserts that the Perl version is at least that value. pperl claims 5.42 compatibility, so any 5.x requirement succeeds; 6+ dies. 2. **Bareword / string**: converts `Foo::Bar` to `Foo/Bar.pm`, then searches `@INC` for the file. If already present in `%INC`, the call is a no-op. Otherwise the file is compiled and executed in a sub-interpreter, subs are registered, and `%INC` is updated. Dies with `"Can't locate ..."` if the file is not found. Returns 1 on success. ## See also use, do, eval, `@INC`, `%INC`