Skip to content

Instantly share code, notes, and snippets.

@tadzik
Created May 1, 2013 18:30
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 tadzik/5497213 to your computer and use it in GitHub Desktop.
Save tadzik/5497213 to your computer and use it in GitHub Desktop.
my @frames;
my $*current;
sub frame(&inner) {
my $*current = [];
&inner();
@frames.push: $*current;
}
sub hit($n) {
$*current.push: $n
}
sub strike {
hit(10)
}
## actual code
frame {
hit 6;
hit 2;
}
frame {
hit 7;
hit 3;
}
frame {
strike;
}
##############
say @frames.perl;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment