use v5.10; #needed for say
{#create a lexical scope
    my $counter = 0; #visible only in this block

    sub count { #despite being in the block, ALL subroutines are
        # package/global, so visible
        $counter++; #increment and return the value before the inc
    }
}

say count();    #print 0
say count();    #print 1
say count();    #print 2
