in reply to Re^3: Mine or Ours
in thread Mine or Ours
our allows you to refer to somebody's package global in unqualified manner, even when you leave the package. But this permission lasts only within lexical scope.
use strict; package First; our $foo = 42; { print $foo; # 42 package Second; print $foo; # 42, refers to $First::foo our $bar = 54; { package Third; print $foo; # 42, refers to $First::foo print $bar; # 54, refers to $Second::bar } } print $Second::bar; # 54, fully qualified. print $bar; # error: not strict-safe as the our is not in scop +e.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Mine or Ours
by shmem (Chancellor) on Jan 21, 2007 at 10:08 UTC |