{ # create a scope for the closure my $count = 0; sub counter { ++$count } } for (1 .. 5) { print counter, "\n"; }