What will be the output of the following program and Why?
is there any significance to symbol table w.r.t to the result?
package Test;
sub func {
print "First instance\n";
}
sub func {
print "Second instance\n";
}
1;
#! /usr/bin/perl
# File: script.pl
use Test;
Test::func();
“Second instance\n”
A package/global variable will have an entry in the symbol table, you can try this to verify:
Link to reference: http://www252.pair.com/comdog/mastering_perl/Chapters/08.symbol_tables.html