in reply to Re: including variables
in thread including variables

You don't want to load values dynamically. Well, then why don't you just use the system's environment to store those temporary values? How many values are we talking about and what are you planning to use them for? Anyway, the benefit is that if you have more than one perl program, then one can set the environment variables, and all the other perl programs that run after that will see those values and can easily access them using $ENV{'myvar'} I can't think of an easier solution than that.

If by accident, you forget to set the environment variables, then your program can easily check to make sure they exist. For example, you could write:

my $V = exists($ENV{'myvar'}) ? $ENV{'myvar'} : 'default value';

OR

exists($ENV{'myvar'}) or die...

Replies are listed 'Best First'.
Re^3: including variables
by GrandFather (Saint) on Feb 18, 2018 at 20:45 UTC
    one can set the environment variables

    Not so easy to do. When run a Perl script gets its own copy of the system environment. It can't directly change the system's copy of environment variables so it can't easily set changes that will be seen by other scripts unless they are forked from the parent script (and thus inherit the parent's environment).

    Premature optimization is the root of all job security