in reply to Devel::Symdump and symbol table woes
In the past, I've noticed that entries in the symbol table (%::) always have a SCALAR component. I guess every package symbol always has a scalar component due to how Perl's guts are written.
package main; our %test = ( a => 1 ); print('SCALAR: ', ( *{ $::{'main::'}{'test'} }{SCALAR} )?1:0, "\n"); print('ARRAY: ', ( *{ $::{'main::'}{'test'} }{ARRAY } )?1:0, "\n"); print('HASH: ', ( *{ $::{'main::'}{'test'} }{HASH } )?1:0, "\n"); ${ *{ $::{'main::'}{'test'} }{SCALAR} } = 'scalar'; print("$test\n"); __END__ SCALAR: 1 ARRAY: 0 HASH: 1 scalar
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Devel::Symdump and symbol table woes
by bpphillips (Friar) on Nov 10, 2005 at 15:35 UTC |