in reply to How to access globals in arbitrary classes, without using soft ref?
use strict; use warnings; use 5.010; { package Foo; our $bar; } { if (exists $::{'Foo::'}{bar}) { say "There's a Foo::bar with some sigil"; } if (exists $::{'Foo::'}{baz}) { say "There's a Foo::baz with some sigil"; } }
(Update: added code)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to access globals in arbitrary classes, without using soft ref?
by llancet (Friar) on Feb 22, 2010 at 09:14 UTC | |
by ikegami (Patriarch) on Feb 22, 2010 at 16:10 UTC |