use strict; use warnings; print 'before package Foo ', exists($main::{'Foo::'}) ? "exists" : "doesn't exist", "\n"; eval q{ package Foo }; print 'after package Foo ', exists($main::{'Foo::'}) ? "exists" : "doesn't exist", "\n"; print 'before our Bar ', exists($main::{Bar}) ? "exists" : "doesn't exist", "\n"; eval q{ our $Bar =99}; print 'after our Bar ', exists($main::{Bar}) ? "exists" : "doesn't exist", "\n"; __END__ # produces before package Foo doesn't exist after package Foo exists before our Bar doesn't exist after our Bar exists