use v5.10;	#enable new features, including state and say

sub count {
    state $counter = 0; #declare and initialize the first time only
    $counter++;	#increment and return the value before the inc
}

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