http://www.perlmonks.org?node_id=837669

bichonfrise74 has asked for the wisdom of the Perl Monks concerning the following question:

I got this code from this article perl.com.
sub make_counter { my $start = shift; return sub { $start++ } } my $from_ten = make_counter(10); my $from_three = make_counter(3); print $from_ten->() . "\n"; print $from_ten->() . "\n"; print $from_three->() . "\n";
I tried to read the article on the explanation of the code above but I could not figure out how it is able to 'retain/remember' the old values.
Can someone further dissect or rewrite this code to show what is exactly happening?