in reply to Can't call method "KEY_READ" on an undefined value

our gives access to a variable having package-wide scope.   Well, sort of ...   From perldoc -f our:

“our” associates a simple name with a package variable in the current package for use within the current scope.   When “use strict ‘vars’” is in effect, “our” lets you use declared global variables without qualifying them with package names, within the lexical scope of the “our” declaration.   In this way "our differs from “use vars,” which is package scoped.

Unlike “my,” which both allocates storage for a variable and associates a simple name with that storage for use within the current scope, “our” associates a simple name with a package variable in the current package, for use within the current scope.   In other words, “our” has the same scoping rules as “my,” but does not necessarily create a variable.

Replies are listed 'Best First'.
Re^2: Can't call method "KEY_READ" on an undefined value
by OzVegan (Acolyte) on May 19, 2011 at 23:02 UTC
    Thank you for this explanation. I read a few articles on it and PerlDoc but neither clearly explained the package scope and I thought I may be creating a global variable for all packages..