sub subfactory { my $static = int(rand(100)); return sub {print "my number is $static\n";} } #### my $func=subfactory(); $func->(); undef $func;