Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Use a Variable in a Separate Perl Script

by temporal (Pilgrim)
on Jun 07, 2012 at 17:15 UTC ( #974996=note: print w/replies, xml ) Need Help??


in reply to Use a Variable in a Separate Perl Script

Depends on what you are doing with these two scripts. It might be time to rethink your design. Maybe what you really want to do is create a package with some functions and variables and then put the program logic into a second script.

#MyModule.pm package MyModule; use strict; our $variable = 'hello!';
#MyScript.pl use strict; use MyModule; print $MyModule::variable;

Also, you can use Exporter if you want to add optionality to your exports.

Strange things are afoot at the Circle-K.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://974996]
help
Chatterbox?
[RonW]: as I understand it, RPerl "compiles" a subset of Perl to C, so I would expect the final executable to run a lot faster
[RonW]: Is there an English language version of the site?
[LanX]: but Afaik Perl is on average about 10-20 times slower than C
[LanX]: no
[LanX]: but I could ask Herbert to elaborate
[1nickt]: http://rperl.org/ performance_benchm arks.html

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (9)
As of 2017-05-22 20:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?