my $foo = "defined"; BEGIN { print "foo is ", defined($foo) ? $foo : 'undef', " during BEGIN phase\n"; }; print "foo is ", defined($foo) ? $foo : undef, " at runtime\n"; # produces foo is undef during BEGIN phase foo is defined at runtime