Skip to content

Instantly share code, notes, and snippets.

@petdance
Created September 29, 2016 01:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save petdance/2351aa104bbc2b2a3bd73d25c4c9a2a9 to your computer and use it in GitHub Desktop.
Save petdance/2351aa104bbc2b2a3bd73d25c4c9a2a9 to your computer and use it in GitHub Desktop.
use 5.010;
require "t/test.pl";
my $i = 2112;
ok( $i == 2112, '$i starts at 2112' );
for $i (1..3) {
somesub();
}
ok( $i == 2112, '$i should go back to 2112 outside of the loop' );
sub somesub {
state $n;
++$n;
ok( $i == $n, '$i is ' . $n );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment