in reply to Re: look up the symbol table of a variable
in thread look up the symbol table of a variable
When I try:
...I get no output, but with this I do:use strict; use Foo::Bar; my $package = 'Foo::Bar'; for my $sym ( keys %{ $::{ "${package}::" } } ) { print "$sym\n"; }
For both, Foo/Bar.pm isuse strict; use Foo::Bar; my $package = 'Foo::Bar'; { no strict q(refs); for my $sym ( keys %{ "${package}::" } ) { print "$sym\n"; } } __END__ PI import
package Foo::Bar; $PI = 3.14; __END__
Update: Simplified code a bit.
the lowliest monk
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: look up the symbol table of a variable
by chas (Priest) on Apr 24, 2005 at 23:22 UTC |