Compile: use Foo; Compile: BEGIN { require Foo; import Foo; } Run: require Foo; (starts compiling Foo.pm) Compile: my $shell = $ENV{'SHELL'} || ""; (my $shell; gets declared) Compile: BEGIN { ... } Run: Code from above BEGIN block ($shell is declared but uninitialized here) Compile: 1; (Foo.pm fully compiled, start running it) Run: my $shell = $ENV{'SHELL'} || ""; Run: 1; (require Foo; returns) Run: import Foo; ...