in reply to local our $var; What does it do?
our $foo aliases $foo to $CURRENT_PACKAGE::foo.
local $foo backs up the value of $foo and causes the backup to be restored when the current lexical scoped it existed.
our $foo returns $foo, so local our $foo is the same as our $foo; local $foo.
Basically local our $foo the closest approximation possible of my $foo, but using package variables instead of lexical variables. I have no idea why you'd want to do that.
Update: I previously had an example that used local our @ARGV = @args;, but that should be just local @ARGV = @args;.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: local our $var; What does it do?
by kcott (Archbishop) on Jun 18, 2015 at 17:20 UTC |