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; } }
In reply to Re: idea for an static variable
by GrandFather
in thread idea for an static variable
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |