http://qs321.pair.com?node_id=911414


in reply to Scoping Rules For "our" Variables

Variable and package names are case sensitive. Simply replace that with $Foo::x and $Bar::x

use strict and use warnings would've alerted you to the problem.

package Foo; our $x = 1; package Bar; our $x = 2; package main; use strict; use warnings; our $x = 3; print "x = $x\n"; print "Foo::x = $foo::x\n"; print "Bar::x = $Bar::x\n"; $x = 4; print "x = $x\n"; print "Foo::x = $Foo::x\n"; print "Bar::x = $Bar::x\n"