AP - Closures
- subroutine reference that carries a lexical scope
sub counter { my $start = shift or 1; return sub { $start++ }; }
- returns an anonymous subroutine bound to $shift
- every call increments the variable
- every call to counter() creates a new counter
Slide 44 of 47