in reply to Re: local our?
in thread local our?
local and our are completely unrelated.
That's not true. local is about aliasing package globals, and our creates a package global in the package where that declaration occurs (and a lexical alias to that in the current scope), so they are related: they both act upon slots in the symbol table of a package. So they are related.
$ perl -E 'package Foo; local our $bar; package main; say for keys %Fo +o::' bar
and
$ perl -E 'our $bar = "foo"; say "1: $bar"; package Foo; { local our $ +bar = "quux"; say "2: $bar"; }; say "3: $bar"; package main; say "4: +$bar"; say "Foo::$_" for keys %Foo::' 1: foo 2: quux 3: foo 4: foo Foo::bar
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: local our?
by ikegami (Patriarch) on Apr 15, 2019 at 01:05 UTC | |
|
Re^3: local our?
by LanX (Saint) on Apr 14, 2019 at 21:15 UTC |