On Tue, Apr 27, 2010 at 2:08 PM, Michael Ludwig <mil...@gmx.de> wrote: > Variables declared with "our" are a funny hybrid between global > variables, which are attached to a package, and lexical variables, > which are attached to a scope.
They are package variables (usually referred to as globals), which have a lexically-scoped alias that lets you call them by their short name. It's the short name alias that is lexical. Here's a normal use of a package variable: package Foo; use strict; use warnings; $Foo::bar = 1; sub print_it { print $Foo::bar; } And here's the exact same thing, using "our" to save some typing: package Foo; use strict; use warnings; our $bar; $bar = 1; sub print_it { print $bar; } Aside from the difference in how you refer to the variable, these are identical. Hope that helps. If it doesn't, try this: http://perldoc.perl.org/functions/our.html - Perrin