use vars qw($foo); # Some code here. package Bar; # Now you can't use $foo, and won't accidentally access $main::foo.