My recommendation would be to declare the variable with the static keyword inside the sub you want to static variable.
Perl 5.8.x is still the default perl for most OS's at this point. I'd recommend that someone know both ways, but unless they can be sure their project is going to be running on the latest version of perl, I'd use the slightly clunkier style. Synatic sugar is nice, but having a working program is better.
Of course, the point that they should know whether they actually want a static variable or not is right on.
In reply to Re^2: Some trouble with closures
by DStaal
in thread Some trouble with closures
by spx2
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |