in reply to Type globs, strict, and lexical variables
I think you are looking for:
{ local *bar # Make sure we don't clobber an existing var. *bar = \@foo; # Create an alias our @bar; # So we don't have to say @Package::bar. print($bar[0]); # Same as print($foo[0]); } # Restores *bar (and therefore $bar, @bar, etc)
The first two lines can be combined:
local *bar = \@foo;
Alternativly, Data::Alias allows one to lexical aliases.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Type globs, strict, and lexical variables
by cems2 (Novice) on Jul 17, 2006 at 05:33 UTC | |
by ikegami (Patriarch) on Jul 17, 2006 at 07:40 UTC | |
|
Re^2: Type globs, strict, and lexical variables
by cems2 (Novice) on Jul 17, 2006 at 05:42 UTC | |
|
Re^2: Type globs, strict, and lexical variables
by cems2 (Novice) on Jul 17, 2006 at 13:38 UTC | |
by ikegami (Patriarch) on Jul 17, 2006 at 17:10 UTC | |
by xmath (Hermit) on Jul 19, 2006 at 09:16 UTC | |
by ysth (Canon) on Jul 20, 2006 at 00:58 UTC |