in reply to look up the symbol table of a variable

%{ $::{ "${package}::" } }

Replies are listed 'Best First'.
Re^2: look up the symbol table of a variable
by tlm (Prior) on Apr 24, 2005 at 21:26 UTC

    When I try:

    use strict; use Foo::Bar; my $package = 'Foo::Bar'; for my $sym ( keys %{ $::{ "${package}::" } } ) { print "$sym\n"; }
    ...I get no output, but with this I do:
    use strict; use Foo::Bar; my $package = 'Foo::Bar'; { no strict q(refs); for my $sym ( keys %{ "${package}::" } ) { print "$sym\n"; } } __END__ PI import
    For both, Foo/Bar.pm is
    package Foo::Bar; $PI = 3.14; __END__

    Update: Simplified code a bit.

    the lowliest monk

      Yes, I think you are correct. (See the 2nd update in my previous reply.)
      chas