use strict; use warnings; package B; our $foo = 3; package main; print "foo is >$foo<\n"; __END__ foo is >3< #### use strict; use warnings; package B; use vars qw($foo); $foo = 3; package main; print "foo is >$foo<\n"; __END__ Global symbol "$foo" requires explicit package name at - line 10. Execution of - aborted due to compilation errors. #### use strict; use warnings; { package B; our $foo = 3; } package main; print "foo is >$foo<\n"; __END__ Global symbol "$foo" requires explicit package name at - line 10. Execution of - aborted due to compilation errors.