in reply to idea for an static variable
Generally you can achieve the same result by using a global variable. Sometimes you may need to constrain the scope of such a global variable to the context of a sub. You can do that by:
{ my $pseudoStatic = 0; sub usingPseudoStatic { return ++$pseudoStatic; } }
|
|---|