Im new to perl.... I guess my earler posting was not clear...
Heres what I tried
test1.pl....
my $value='abcdef';
$ENV{'PLATFORM'}=$value;
###### I belive this should set the environment variable PLATFORM

#just to confirm I called another perl program from with in this so if the environment is set then it should be reflected in the called program.
my $res=`perl c:/temp/test2.pl`;
print"\n result from test2.pl == $res\n";

test2.pl.....
my $val=$ENV{'PLATFORM'};
print "\n value of envir var platform= $val\n";
####### I belive this should now give abcdef

RESULTS:
#when test1.pl was run
result from test2.pl == value of envir var platform= abcdef

#### Thus I belive that the environment variables are actually set with in the life time of perl program test1.pl... please correct me if iam wrong.

########## Now my question ############
I need to do a similar stuff but the problem is that the environment variables which need to be set are available in a configuration file which needs to be read and then set, I tried to use a code as given in my earlier posting; however the problem was that when ever I use

$ENV{"$variable"}="$value"; # nothing seems to be happening

$ENV{'PLATFORM'}="$value" ; # This seem to work

is it not possible to use variables "$variable" inside $Env{ }, should it only be specified a string 'blah' ?? please advice...

Thanks Robby

In reply to Re^2: Setting environment variables by reading them from a configuration file by robby123
in thread Setting environment variables by reading them from a configuration file by robby123

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.