in reply to Passing value from IF loop

Setting of the environment variable is not being passed outside the current environment.

If you are asking what I think you are asking perhaps write the value to a file if you want persistence between runs.

print "Good ",qw(night morning afternoon evening)[(localtime)[2]/6]," fellow monks."

Replies are listed 'Best First'.
Re^2: Passing value from IF loop
by dasgar (Priest) on Sep 24, 2010 at 17:28 UTC

    I agree with Utilitarian's comments about the current environment. To illustrate his point, you can do the following test:

    1. Open two command prompts.
    2. In the first command prompt, add/modify an environment variable.
    3. In the second command prompt, check on that environment variable. It won't see any changed values or any new variables.
    4. Open a third command prompt and check on the environment variable added/modified in step 2. This time, the addition/change should be detected.

    Personally, I am unaware of how to 'reset' the environment for command prompt or script, but that's not to say it can't be done. Short of doing that, I think Utilitarian's suggestion of writing to a file would be a good idea.