Just what I needed. Merci Bart.
- -
On Sat, 12 Mar 2005 10:27:49 +0100, Bart Lateur wrote:

>Use a lexical, in a block around your subs you want to allow access.
Like this:

        {
            my $count;

            sub get {
                return ++$count;
            }

            sub clear {
                undef $count;
            }
        }

        $\ = "\n";
        for (1..5) {
           print get;
        }
        clear();
        for (1..3) {
           print get;
        }

Result:

        1
        2
        3
        4
        5
        1
        2
        3
- -

Reply via email to