sub foo { state $x = 0; # $x will retain it's state through # successive invocations of foo() # ... }