=over =item our EXPR X X =item our TYPE EXPR =item our EXPR : ATTRS =item our TYPE EXPR : ATTRS C makes a lexical alias to a package variable of the same name in the current package for use within the current lexical scope. C has the same scoping rules as C or C, but C only declares an alias, whereas C or C both declare a variable name and allocate storage for that name within the current scope. This means that when C is in effect, C lets you use a package variable without qualifying it with the package name, but only within the lexical scope of the C declaration. In this way, C differs from C, which allows use of an unqualified name I within the affected package, but across scopes. If more than one value is listed, the list must be placed in parentheses. our $foo; our($bar, $baz); An C declaration declares an alias for a package variable that will be visible across its entire lexical scope, even across package boundaries. The package in which the variable is entered is determined at the point of the declaration, not at the point of use. This means the following behavior holds: package Foo; our $bar; # declares $Foo::bar for rest of lexical scope $bar = 20; package Bar; print $bar; # prints 20, as it refers to $Foo::bar Multiple C declarations with the same name in the same lexical scope are allowed if they are in different packages. If they happen to be in the same package, Perl will emit warnings if you have asked for them, just like multiple C declarations. Unlike a second C declaration, which will bind the name to a fresh variable, a second C declaration in the same package, in the same scope, is merely redundant. use warnings; package Foo; our $bar; # declares $Foo::bar for rest of lexical scope $bar = 20; package Bar; our $bar = 30; # declares $Bar::bar for rest of lexical scope print $bar; # prints 30 our $bar; # emits warning but has no other effect print $bar; # still prints 30 An C declaration may also have a list of attributes associated with it. The exact semantics and interface of TYPE and ATTRS are still evolving. TYPE is currently bound to the use of the C pragma, and attributes are handled using the C pragma, or, starting from Perl 5.8.0, also via the C module. See L for details, and L, L, and L. =back