Entry
I have a variable in a new function in a Perl module, I want that varaible to retain its value.
Sep 19th, 2003 10:12
Vincent Milette, Kunal Kapoor,
In your perl-module, you must export the variable. That way, you will be able to use it
elsewhere.
If you don't know how to export the variable here is the way
...in your module after the package name...
use Exporter;
use vars qw(@ISA @EXPORT $VERSION);
$VERSION = 1.00;
@ISA = qw(Exporter)
;
@EXPORT = qw($var); #export the var to other module or script including this module
use vars qw ($var); # give the possibility to use the var in the module
By exporting the var this way it is easier to create a config file for your program...I do it
like that all the time
For further help, see:
http://stein.cshl.org/genome_informatics/using_perl_modules/index.html
There is a chapter about Exporting module
There is also other way to do what you want...because with perl..."There's More Than
One Way to Do It"
HTH
Vincent M.