> -----Original Message----- > From: Daryl J. Hoyt [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, October 24, 2001 4:22 PM > To: Beginners Perl > Subject: Pushing and Popping ENV > > > Hi, > I would like to run a script that would significantly change the > environment several times. I was wondering if there is a way > to push and > pop the environment table in Perl so I could always start > with the original > environment table. Any ideas.
You can use local() for this: print $ENV{PATH}; # prints "original value" { local $ENV{PATH} = "/usr/bin:/usr/sbin"; system($blah); # picks up changed PATH } # local var goes out of scope print $ENV{PATH}; # prints original value again -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]