I don't understand the terminology you are using.
I have a perl package 'A' in which i have defined a variable in global section.
What is the "global section" of a Perl package?
... how many times will the variable in global section be redefined out of these 3 actions : object creation,function 1 call , function 2 call
I don't understand the word "redefined" in this context. Do you perhaps mean "accessed", either for read or write?
As already suggested, here's some code to perhaps provide a basis for discussion:
c:\@Work\Perl\monks>perl -wMstrict -le "{ package A; our $count = 0; ;; sub new { my $class = shift; ++$count; return bless [ @_ ] => $class; } ;; sub ding { my $self = shift; print 'ding'; return ++$count; } } ;; print 'count is: ', $A::count; ;; print 'create A object'; my $oa = A->new('hi there'); print 'count is: ', $A::count; ;; $oa->ding; print 'count is: ', $A::count; ;; $oa->ding; print 'count is: ', $A::count; " count is: 0 create A object count is: 1 ding count is: 2 ding count is: 3
Give a man a fish: <%-{-{-{-<
In reply to Re: Perl package scope of global variables
by AnomalousMonk
in thread Perl package scope of global variables
by aswingeo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |