do#
FILE
Synopsis#
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
%INCcaching).Does not die on failure; instead it returns
undefand 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