my @foo = { state $n=-1; $n++; my $p=$n; sub ($x,$y) { $x+$y+$p } } ... *;