As you might know Perl version 5.10 has introduce a keyword called state that allows the creation of so-called state variables. These are very similar to the static variables of C. You declare them insied a function. They are scoped to the function so you cannot reach them from the outside, but they never get destroyed and they are initialized only once.
Dave Horsfall suggested to use this feature to detect unwanted recursion. Or calling the same function twice.
Perl Maven Pro - screencasts with articles
As a Perl Maven Pro subscriber you will enjoy a growing library of articles and screencasts.
Two screencasts a week and all the previous screencasts!
Ad free browsing!
The articles contain topics such as Web Application Development, Object Oriented programming, testing, deployment, code walkthroughs, best practices, and many more subjects in Perl, and in related technologies.
Subscriptions include all previous pro episodes.
If you already have Perl Maven Pro subscription, you will need to login to access the articles.