Paul Kraus wrote: > Great article. Cleared up all of my confusion. However it did not > touch on "our". Anyone care to explain what its used for.
Hi Paul. An 'our' variable has the same visibility as a 'my' variable declared in the same place, i.e. through to the end of the current lexical scope (block or file). Unlike 'my', however, it is a permanent package variable and its value will be retained across calls to a subroutine (unless modified elsewhere). It may be accessed anywhere (even from another package) by fully qualifying it. Take a look at this: #!perl use strict; use warnings; &a; # sets $main::val &b; # prints '10' print $val; # illegal - undeclared print $main::val; # prints '10' sub a { our $val = 10; } sub b { our $val; print $val; } __END_ HTH, Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]