Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 13. Miscellany > Item 118. Access the symbol table with typeglobs

Item 118. Access the symbol table with typeglobs

You aren’t really supposed to know about the symbol table or typeglobs, where Perl keeps track of package variables, named subroutine definitions, and bareword filehandles. For almost anything you might need from the symbol table, you can use lexical variables, references, or object-oriented programming instead. However, sometimes you can’t avoid it. You might also encounter the symbol table and typeglobs from time to time in old Perl code, so you should be aware of what they look like and what they do.

In Perl, you can use the same identifier for different variables—for instance, $foo, @foo, %foo, &foo, foo (as a filehandle), and so on. Perl keeps track of all of the things named “foo” in the symbol table entry for that name.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint