Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^2: To module or not?

by bradcathey (Prior)
on Apr 26, 2005 at 15:26 UTC ( [id://451628]=note: print w/replies, xml ) Need Help??


in reply to Re: To module or not?
in thread To module or not?

A follow up question might be: is there a way to have global variable shared between the main::space and the module::space so I don't have to keep passing the same values over and over? (I know, not a good idea, but just for the sake of discussion)

So, instead of:

#MAIN: my $foo = "aaaaaaa"; my $bar = "bbbbbb"; print add_strings ($foo, $bar);

Be able to just have:

#MAIN: my $foo = "aaaaaaa"; my $bar = "bbbbbb"; print add_strings (); #MODULE: our ($foo, $bar); #this might be make-believe add_strings { my $newstring = $foo . $bar; return ($newstring); }

—Brad
"The important work of moving the world forward does not wait to be done by perfect men." George Eliot

Replies are listed 'Best First'.
Re^3: To module or not?
by Fletch (Bishop) on Apr 26, 2005 at 15:44 UTC

    You could always reference $main::foo et al, but you'd have to use our $foo in main rather than my (lexicals not living in the symbol table and all).

    But yeah, not a good idea. Action at a distance, and what not.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (8)
As of 2024-04-19 15:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found