in reply to Re^2: static storage in a local subroutine?
in thread static storage in a local subroutine?

Yes, it's beginning to make sense: "Barrie Slaymaker calls closures "inside-out objects:" objects are data that have some subroutines attached to them, and closures are subroutines that have some data attached to them."

sub make_counter { my $start = shift; return sub { $start++ } } my $from_ten = make_counter(10); my $from_three = make_counter(3); print $from_ten->(); # 10 print $from_ten->(); # 11 print $from_three->(); # 3 print $from_ten->(); # 12 print $from_three->(); # 4
This example helped me understand a lot better.