Hello.
What I really want (if the code worked as I was expecting):
sub create_f { my $func = shift; return sub { my $var = "xpto"; &$func; } } my $function = create_f( sub { print ">> $var <<\n" } );
I mean, supply a function that uses a variable that is declared outside. Of course I do not want this on this context, this is just my test code.
I do not want to make the variable global to the package.
Any hints?
Thanks! :)
Alberto Simões
In reply to Making variables visible between calls. by ambs
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |