in reply to Re: Using Variables
in thread Unitialized value warnings with require

Storable is a more reliable way to store variables. From the Storable manpage:

use Storable; store \%table, 'file'; $hashref = retrieve('file');

or alternatively:

use Storable qw(nstore store_fd nstore_fd freeze thaw dclone); # Storing to and retrieving from an already opened file store_fd \@array, \*STDOUT; nstore_fd \%table, \*STDOUT; $aryref = fd_retrieve(\*SOCKET); $hashref = fd_retrieve(\*SOCKET);

Of course, if you need to include other things besides variables in the config, you may want to consider turning your code into a module

Replies are listed 'Best First'.
Re: Re: Re: Using Variables
by runrig (Abbot) on Dec 28, 2001 at 00:15 UTC
    Storable is a more reliable way to store variables.

    Except that then you lose the ability to easily view and edit the file, which is what you'd like to be able to do with most config files (I like Storable, but not for this) :-)

      Using Data::Dumper instead of Storable, you get output that is both reliable and editable. It works for Net::Config...

          -- Chip Salzenberg, Free-Floating Agent of Chaos