use feature "state"; sub a { state $i++; print $i; } a(); a(); a();