* Anthony Ettinger <[EMAIL PROTECTED]> [2006-05-02T15:04:53]
> I want to double-check that it is correct to use "our" to import globals.
>
> BEGIN {
> our $foo = 'foo';
> }
>
> sub something {
> our $foo;
> our $bar;
> }
> [ ... ]
> Is this the correct way to import globals?
Yes, if by "globals" you mean "globally accessibly, and therefore screw-up-able
from anywhere."
You'd probably be better off, in most cases, with lexicals
my $foo = 'foo'; # or: my $foo; BEGIN { $foo = 'foo' }
sub something {
...
}
That way, people ourside your file can't access your private data.
--
rjbs
signature.asc
Description: Digital signature
