sub foo { my $n = shift; my $f = sub { my $i = shift; return $i+$n; }; return $f; }