in reply to Re: increasing value every time sub routine called
in thread increasing value every time sub routine called

No, he doesn't. He isn't asking for multiple instances of counters. A single subroutine with an external variable (or an internal state variable) will do.
sub next_number {no warnings;++$::N} say next_number; say next_number; say next_number; __END__ 1 2 3

Replies are listed 'Best First'.
Re^3: increasing value every time sub routine called
by dave_the_m (Monsignor) on Dec 09, 2011 at 15:33 UTC
    Well in perl land, a single (named) subroutine with a (lexical) external variable is still classed as a closure.

    Dave.

      Note that my solution does not use any lexical variables.