in reply to How to access a variable inside subroutine?
Hello Pritesh,
Even though the variable is static, it is still only visible within the block where it was declared. In your example, the variable still exists, but inaccessible from outside the counter subroutine
Hope this helps.
In Section
Seekers of Perl Wisdom