in reply to increasing value every time sub routine called

well, if you really want to do this:
use feature "state"; sub a { state $i++; print $i; } a(); a(); a();
prints 123