In this code, the variable $n stays alive even after the call to make_incrementor ends
as it is referenced from the anonymous function returned by make_incrementor.

$f3 and $f7 are references to the anonymous functions generated and returned by make_incrementor.
If we printed out the content of these variables using say $f3 we would get something like this: CODE(0x7fe9738032b8)
revealing the fact that they are indeed references to executable code.

The way to de-reference them is to write: $f3->(2).

Perl without extra local variable

sub make_incrementor {
my ($n) = @_;
return sub { $n + shift }
}

This could be use to replace the above implementation of the make_incrementor.