exporting vars from nested "do file;"

I have a configuration file I read using
  do "config.rc";
Usually it just contains some assignments. But now I need to read another file from this one. When I put inside config.rc the statement
  do $nested_config_file;
then the variables assigned inside the nested config file are not defined in the main program.

How can I make the variables defined in the nested config file available to the main program, without changing the main program code?
Who is Participating?
ozoConnect With a Mentor Commented:
The variables should be available to the main program.
Can you post some sample code that does not do what you expect?
How are the variables assigned inside the nested config file?
How are you setting $nested_config_file ?
yonatAuthor Commented:
The nested config file is just a series of
    $some_var = 'some_value';

$nested_config_file is based on some CGI parameter, and I checked and made sure that it does indeed hold the right path, so I know this is not the problem.
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

yonatAuthor Commented:
Just to make sure: by Perl's definition, are the variables SUPPOSED to be available to the main program? I mean, should I just look for some little error somewhere, or do I need write some explicit code to export them?
if say CGI, is your perl program run by a webserver?
WHen will the nested rc file be generated?
yonatAuthor Commented:
Thanks for your help guys. After understanding that this is not a Perl problem, I found out that I did not set the permissions for the nested config file correctly. Now everything works!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.