--- Madhu Reddy <[EMAIL PROTECTED]> wrote: > Hi, > I want to put MFILE=mdl_data.txt in ENV and want to > access later.. > i am trying following...I am getting error... > system(`MFILE=mdl_data.txt`); > $k6 = "MFILE"; > $key6 = $ENV{$k6}; > print "$key6 \n"; > how to do this ?
The system() call spawns a subprocess with it's own environment, in which you set the variable. Then the process ends and it's environment is recycles, along with your variable, before the next statement. Just set it directly: $ENV{MFILE}='mdl_data.txt'; Also, there's an error there: your system call argument is in backticks. That shells out a subprocess to do the assignment, which gets cleaned up as before, but creates no output. The output (none) is returned _from_the_backticks_to_the_system()_call_as an argument to be fed to *another* subprocess..... In other words backticks and system() are each basically doing the same thing, except that backticks return the output to their context and system() doesn't, so DON'T use both unless you want one's output as the arg for the other! __________________________________________________ Do you Yahoo!? Yahoo! Shopping - Send Flowers for Valentine's Day http://shopping.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]