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.