ADD_COUNTER_CLOSURE: { # $add is not accessible outside of closure, but # you do the 'getter', "add" which has access to $add my $add = 0; sub counter { my @nums = (1..500); for my $num(@nums) { $add += $num } } # getter sub add { return $add; } } # $add is not accessible directly here, must use add subroutine my $add = add; print qq{$add\n}; # increment $add via closure() counter(); $add = add; print qq{$add\n};