in reply to Re^2: local our?
in thread local our?
The fact that they both can take a package variables as an argument doesn't make them related in any meaningful way.
local is about aliasing package globals
No. For example, my %h; local $h{x};. It's about making temporary backups of some values.
our creates a package global
No. our creates a lexical variable (that's aliased to the specified package variable).
Simply mentioning the package var is what creates it.
$ perl -le' print $::{var} // "[undef]"' [undef] $ perl -le'$var; print $::{var} // "[undef]"' *main::var
|
|---|