On Wed, Jan 15, 2003 at 11:36:29AM -0500, [EMAIL PROTECTED] wrote: > I want to write a perl script to > replace a Unix shell script which > does nothing other than create > and set environment variables. > > So the perl script might look something like this: > > $ENV{GREGSVAR}='Hello'; > > except that when I run the script, the > assignment doesn't seem to stick, and > the environment variable GREGSVAR doesn't > exist after the perl script is finished > executing. > > looking up environment variables in the > perl bible and the perl cookbook didn't > show anything about sticky environment variables. > > can this be done in perl?
Check the FAQ (perldoc -q environment): I {changed directory, modified my environment} in a perl script. How come the change disappeared when I exited the script? How do I get my changes to be visible? Unix In the strictest sense, it can't be done--the script executes as a different process from the shell it was started from. Changes to a process are not reflected in its parent--only in any children created after the change. There is shell magic that may allow you to fake it by eval()ing the script's output in your shell; check out the comp.unix.questions FAQ for details. Ronald _______________________________________________ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm