=over =item our EXPR =item our EXPR TYPE =item our EXPR : ATTRS =item our TYPE EXPR : ATTRS An C declares the listed variables to be valid globals within the enclosing block, file, or C. That is, it has the same scoping rules as a "my" declaration, but does not create a local variable. If more than one value is listed, the list must be placed in parentheses. The C declaration has no semantic effect unless "use strict vars" is in effect, in which case it lets you use the declared global variable without qualifying it with a package name. (But only within the lexical scope of the C declaration. In this it differs from "use vars", which is package scoped.) An C declaration declares a global 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 Multiple C declarations in the same lexical scope are allowed if they are in different packages. If they happened to be in the same package, Perl will emit warnings if you have asked for them. 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 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 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. The only currently recognized C attribute is C which indicates that a single copy of the global is to be used by all interpreters should the program happen to be running in a multi-interpreter environment. (The default behaviour would be for each interpreter to have its own copy of the global.) Examples: our @EXPORT : unique = qw(foo); our %EXPORT_TAGS : unique = (bar => [qw(aa bb cc)]); our $VERSION : unique = "1.00"; Note that this attribute also has the effect of making the global readonly when the first new interpreter is cloned (for example, when the first new thread is created). Multi-interpreter environments can come to being either through the fork() emulation on Windows platforms, or by embedding perl in a multi-threaded application. The C attribute does nothing in all other environments. Warning: the current implementation of this attribute operates on the typeglob associated with the variable; this means that C also has the effect of C. This may be subject to change. =back