On Mon, 9 Dec 2002, Tamsin wrote: > The changing of the environment variable only affects what happens in > that script not the whole of the machine? I have visions of > confusing the server for ever more...
Yes, you're only setting the environment for the process that's executing. System picks a default $TZ that it hands to all processes spawned. If one of these is your shell, it'll inherit it, though you may have a login profile that changes it to something else before you see it. You can change $TZ in your shell, without affecting the parent. You run perl, it inherits the environment (and thus $TZ) from your shell, or if you've not tinkered with it, from the system. You can change $TZ in perl, when the program finishes, its enviroment is discarded. While you program is running, the shell still keeps its original $TZ, regardless of what the program changes (and thus any oter programs it starts while your perl one is running will also get the shells settings, not those of the perl process) Oh, and any process you spawn from within your perl program will inherit was you've set in perl, which is generally what you want, but may catch you out if you forget to think about it, and are doing much time-related stuff. the hatter