Question:

Write a program that explains the symbolic table clearly.

Answer:

In Perl, the symbol table is a hash that contains the list of all the names defined in a namespace and it contains all the functions and variables. For example:

sub Symbols
 
{
 
my($hashRef) = shift;
 
my(%sym);
 
my(@sym);
 
%sym = %{$hashRef};
 
 
@sym = sort(keys(%sym));
 
foreach (@sym)
 
{
 
printf("%-10.10s| %s\n", $_, $sym{$_});
 
}
 
}
 
Symbols(\%Foo::);
 
package Foo;
 
$bar = 2;
 
sub baz {
 
$bar++;
 
}

 


Keywords:

© 2017 QuizBucket.org