in reply to Loading variables from a separate script

Let's say you have two files, the first file1.pl:
$first_num=10.0095; $last_num=72.0967; $mem_first="77xptj52";

and a second file, file2.pl:

use vars qw($first_num $last_num $mem_first); use strict; do "file1.pl"; print( "$first_num, $last_num, $mem_first\n" );

I have tested the above code, which works fine. Now, importing every variable (with use vars) can be quite tiresome. So you'll often find in corporates that use Perl that they often import a single hash with all the data inside, like so (file3.pl):

%everything = ( first_num => 10.0095, last_num => 72.0967, mem_first => "77xptj52", );

Finally, file file4.pl would contain:

use vars qw( %everything ); use strict; do "file3.pl"; print( join( ", ", $everything{first_num}, $everything{last_num}, $everything{mem_first}, ), "\n" );

(Also tested, and perl -w file4.pl produces identical results to perl -w file2.pl), hope this helps!