The file is a text file ( configuration files ), not a Perl script file. Just a text file containing line of variable=value and the Perl script will read and parse the line and create environment variables out of them.
Config.txt DB_ID="tst" # # MODIFIED_TIME=-3:0:0:0 # CREATEDINQUALIFIER=created_in=$ENV{'LOCAL_DB_ID'} ... perl script file open ( CONFIG_FILE, "${CONFIGURATION_FILE}" ) || LOGMESSAGE( "Unable to open configuration file ${CONFIGURATION_FILE}\n"); while (<CONFIG_FILE>) { next unless ! /^#/; /(.*?)=(.*)/; $ENV{${1}} = ${2}; #Create environment variables } close(CONFIG_FILE); How can I have the $ENV{'LOCAL_DB_ID'} expanded when I access the "CREATEDINQUALIFIER" ( $ENV{'CREATEDINQUALIFIER'} ) environment variable? So my end result will be: "created_in=tst" and not "created_in=$ENV{'LOCAL_DB_ID'}" -----Original Message----- From: stuart arnold [mailto:[EMAIL PROTECTED] Sent: Friday, November 03, 2006 11:20 PM To: Wong, Danny H.; 'Sisyphus'; 'khozaima shakir'; perl-win32-users@listserv.ActiveState.com Subject: RE: Expanding environment variables 1. ALWAYS have "use strict" and "use warnings" as the first 2 lines in your script. 2. This will fix your problem as Perl wants variables to be declared in the form of "$varable", "@variable" or "%variable". So try this: my $CREATEDINQUALIFIER; my $created_in; $CREATEDINQUALIFIER = $created_in = $ENV{'LOCAL_DB_ID'}; (unless I did not understand your problem). Regards! -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Wong, Danny H. Sent: Friday, November 03, 2006 8:22 PM To: Sisyphus; khozaima shakir; perl-win32-users@listserv.ActiveState.com Subject: Expanding environment variables Hi Perl GURU's, In my Perl script, I read a text file and parse each line delimited by the first "=" character and create environment variables for each line of data. My question is: is there a way to expand the environment variable when trying to assign an environment variable value as part of the line of data? Example: Text file example: DB_ID="tst" # # MODIFIED_TIME=-3:0:0:0 # CREATEDINQUALIFIER=created_in=$ENV{'LOCAL_DB_ID'} $ENV{'CREATEDINQUALIFIER'} gives me "created_in=$ENV{'LOCAL_DB_ID'}" value. I'll like it to receive the following value "created_in=tst"; Any suggestions? - - - - - Appended by Scientific Atlanta, a Cisco company - - - - - This e-mail and any attachments may contain information which is confidential, proprietary, privileged or otherwise protected by law. The information is solely intended for the named addressee (or a person responsible for delivering it to the addressee). If you are not the intended recipient of this message, you are not authorized to read, print, retain, copy or disseminate this message or any part of it. If you have received this e-mail in error, please notify the sender immediately by return e-mail and delete it from your computer. _______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs _______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs