start page | rating of books | rating of authors | reviews | copyrights

Advanced Perl Programming

Advanced Perl ProgrammingSearch this book
Previous: B.8 Meta-Information Appendix B
Syntax Summary
Next: B.10 Filehandles, Formats
 

B.9 Typeglobs

  1. Typeglobs assignment aliases identifiers. In the following example, all identifiers named a (scalar, array, hash, subroutine, filehandle, format) are also available as b :

    *a = *b ;     # Alias $b = 10;      # Same as modifying $a b();          # Same as calling a()
  2. Selective aliasing:

    *a = \$b ;    # Only $a aliased to $b
  3. Constants:

    *a = \10;     # Alias a typeglob to a reference to a constant $a = 20;      # Run-time error - "Attempt to modify read-only variable"


Previous: B.8 Meta-Information Advanced Perl Programming Next: B.10 Filehandles, Formats
B.8 Meta-Information Book Index B.10 Filehandles, Formats