good enough for me, thanks!

../allan


Adam Witney wrote:
> 
> Don't know if this is the best way, but here is one way...
> 
> ###### hash.pl #########
> 
> #! /usr/bin/perl -w
> 
> %bar = (
>         'A' => 1,
>         'B' => 2
>        );
> 
> 1;  # as hash.pl must return a true value when require'd
> 
> ###### myscript.pl #####
> 
> #! /usr/bin/perl -w
> 
> use strict;
> use vars qw(%bar);
> 
> require 'hash.pl';
> 
> print $bar{'A'};
> 
> ....etc etc
> 
> Adam
> 
> > hi
> >
> > i have a few large hashes that i would like to store in a
> > seperate file for readability reasons instead of in my main file.
> >
> > i need those hashes to be available/visible to any other
> > files that my main script might 'require'.
> >
> > is it possible to have a seperate file and possibly do
> > something like this in the main script:
> >
> > BEGIN {require 'hash.file'}
> >
> >
> > i have tried that but then i get:
> >
> > Variable "%hash_index" is not imported ...
> >
> >
> > so i guess bascially i want to know how to import a hash (or
> > any variable)?
> >
> >
> > ../allan
> >

Reply via email to