Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Unknown entries in %main::

by pg (Canon)
on Dec 18, 2002 at 03:12 UTC ( #220748=note: print w/replies, xml ) Need Help??


in reply to Unknown entries in %main::

(Update: I read your reply, so you really want to know. Okay, don't forget those perlvars named $^C (COMPILING), $^F (SYSTEM_FD_MAX) etc., when you print them, they show as little unrecognizable symbols. Use ord to print out their ascii values, then you will recognize them. :-)

The output from your code is not that meaningful, isn't it?

Yes, Symbol table is a hash, but not really that straight. Think about this, in a hash you can not have duplicate keys, but in your program, you might have a hash and a scalar both named abc.

Don't forget typeglob.
foreach $symname (sort keys %main::) { local *sym = $main::{$symname}; if (defined $sym) { print "\$$symname is defined, and value is $$symname\n"; } if (defined @sym) { print "\@$symname is defined, and value is @$symname\n"; } if (defined %sym) { print "\%$symname is defined, and value is %$symname\n"; } }

Replies are listed 'Best First'.
Re: Re: Unknown entries in %main::
by jerrygarciuh (Curate) on Dec 18, 2002 at 03:23 UTC
    Hmm, well your code also produces some mystery entries. Can someone tell me what the sqares represent here?
    TIA
    jg
    $ is defined, and value is 256 $ is defined, and value is C:\Perl\bin\perl.exe $" is defined, and value is $$ is defined, and value is 345389531 $/ is defined, and value is $0 is defined, and value is C:\WINDOWS\Desktop\Edit2 $@ is defined, and value is %CORE:: is defined, and value is %CORE:: %DynaLoader:: is defined, and value is %DynaLoader:: %ENV is defined, and value is %ENV @INC is defined, and value is C:/Perl/lib C:/Perl/site/lib . %IO:: is defined, and value is %IO:: %UNIVERSAL:: is defined, and value is %UNIVERSAL:: %Win32:: is defined, and value is %Win32:: $_<..\universal.c is defined, and value is ..\universal.c $_<..\xsutils.c is defined, and value is ..\xsutils.c $_<.\win32.c is defined, and value is .\win32.c $_<perllib.c is defined, and value is perllib.c %attributes:: is defined, and value is %attributes:: %main:: is defined, and value is %main:: $symname is defined, and value is symname
    _____________________________________________________
    "The man who grasps principles can successfully select his own methods.
    The man who tries methods, ignoring principles, is sure to have trouble.
    ~ Ralph Waldo Emerson

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://220748]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (5)
As of 2022-09-26 09:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer my indexes to start at:




    Results (117 votes). Check out past polls.

    Notices?