Jürgen Exner <> wrote:
> Fred wrote:
>> The two subs below are in a package named Mypkg.pm.
>> The LoadConfig sub uses AppConfig. In this sub I
>> can print the host variable using $config->host().
>> So I added the line our $hostx = $config->host(),
>> to assign this to $hostx. >
>> sub LoadConfig
> [...]
>> our $hostx = $config->host();
>
> The "our" makes this a variable that is visible only within the sub
> LoadConfig()
No, it makes the short name ($hostx) visible only within the (sub) block.
The long name ($Some:

ackage::hostx) can still be used to access
that variable.
> Make $hostx a global variable.
It already is a package (global) variable.
our() does not scope variables, it only scopes a _name_
for the variable.
--
Tad McClellan SGML consulting
Perl programming
Fort Worth, Texas