Hi there,

I am using the first example and the array variable always is blank. Any clues why?

#########################
# the first way
#########################
The first way,you can just require a file,because this file hasn't be
declared as a package,it doesn't have its own namespace.So all global
variables in this file can be imported into main script's namespace.

$ cat mydata.pl
use strict;
our (@key1,@key2);
$key1[64]="0xc120718a1ccce7f8";
$key2[64]="0xeadf28cb82020921";
$key1[128]="0xaf503224b6cff0639cf0dc310a4b1277";
$key2[128]="0x3e1fcbd4e91ca24bb276914de3764cdf";
1;

$ cat usedata.pl
require 'mydata.pl';
print $key1[64];


cheers,

Noah


Jeff Pang wrote:

     > Message du 08/10/08 12:45
     > De : "Noah"
     > A : "Perl Beginners"
     > Copie à :
     > Objet : use variables from another file
     >
     >
     > Hi there,
     >
     > I have created a common perl file that other perl programs can
    refer to
     > so I only have one place to set the values for many different perl
     > programs.
     >

See this HOWTO:
http://home.arcor.de/pangj/share_variables_between_perl_scripts.txt


Regards,
Jeff.



/Créez votre adresse <http://www.laposte.net> électronique [EMAIL PROTECTED]
1 Go d'espace de stockage, anti-spam et anti-virus intégrés./


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to