![]() |
|
Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re: using main programs variables inside packagesby ant (Scribe) |
on Oct 19, 2001 at 12:50 UTC ( #119904=note: print w/replies, xml ) | Need Help?? |
A little confused on about your email, however I'll stick my two cents in.
if you create a variable in X.pm, you can then export that
variable into X.pl. in X.pm package X; vars $database1 = "database"; vars $username1 = "user1"; vars $password1 = "user1"; use vars qw(@ISA @EXPORT @EXPORT_OK); use Exporter; @ISA = qw(Exporter Shell); @EXPORT = qw( $database1 $username1 $password1); 1; now in X.pl use X.pm print "$database1,$username1,$password1"; you can also export sub routines. Hope that helps. Ant
In Section
Seekers of Perl Wisdom
|
|