At the office we run an AIX ver 5 rel 3 system. We have a Perl script that given its parameters makes a decision on how to call several other programs. One of the programs that it calls is a compiled C program. I was having problems so I investigated and found that an environment variable that is known to the Perl script is not received by the compiled C program. The Perl script uses the Perl 'system' function to run the compiled C program. According to the information I found for AIX the limit of parameters and environment variables is very large for our system, so that is not the problem.

Any ideas as to why an environment variable gets lost when the C program is called ?

Did you print $ENV{YOURVARIABLE} *right* before invoking system(), and also print getenv("YOURVARIABLE") just in the beginning of your main() function in the C program? I bet they don't disappear inbetween.

Thanks to all who replied to my posting. I have finally solved the problem. The problem was that I set the value of the environment variable from the command line, next I ran the Perl script which ran the compiled C program by passing a single string to system(). When system() fork'ed a shell to run the specified C program it read my $HOME/.kshrc file which contained another definition of the environment variable which ended up overwriting the value I had entered manually from the command line.