Skip to content

Instantly share code, notes, and snippets.

@mirekfranc
Created June 28, 2015 21:18
Show Gist options
  • Save mirekfranc/1612127952f495bd7d00 to your computer and use it in GitHub Desktop.
Save mirekfranc/1612127952f495bd7d00 to your computer and use it in GitHub Desktop.
state and say features from perl 5.10...
use feature qw(state say);
sub counter {
state $a = 0;
return ++$a;
}
say counter; # => 1
say counter; # => 2
say counter; # => 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment