Created
June 28, 2015 21:18
-
-
Save mirekfranc/1612127952f495bd7d00 to your computer and use it in GitHub Desktop.
state and say features from perl 5.10...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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