--- name: do status: documented runtime: pp source: src/runtime/pp/system.rs --- ```{index} single: do; Perl built-in (pp runtime) ``` # do FILE ## Synopsis ```perl do "config.pl"; my $result = do "/path/to/file.pm"; ``` ## Description Reads, compiles, and executes a Perl file, returning the value of the last expression evaluated. Unlike `require`, `do FILE`: - Always re-reads and re-executes the file (no `%INC` caching). - Does **not** die on failure; instead it returns `undef` and sets `$@` to the error message. - Does **not** inherit caller lexicals (unlike `eval STRING`). - Evaluates the file in the current package context. On success, returns the value of the last expression evaluated in the file and clears `$@`. On compilation or runtime error, returns `undef` and sets `$@`. ## See also require, eval, use