Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Making variables visible between calls.

by Arunbear (Prior)
on Dec 12, 2008 at 18:31 UTC ( [id://730011]=note: print w/replies, xml ) Need Help??


in reply to Making variables visible between calls.

You could put the variables into some other package which exists just to hold them e.g.
#!/usr/bin/perl use strict; use warnings; sub create_f { my $func = shift; return sub { $MyBucket::var = "xpto"; &$func; } } my $function = create_f( sub { print ">> $MyBucket::var <<\n" } ); $function->();

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://730011]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (2)
As of 2024-04-26 01:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found