in reply to Keeping environment variables after perl has exited

As is often the case, the answer is "it depends". All of the shells (or at least all that I have used) provide a method for 'source'ing a script -- run in the current environment, do not spiel off a separate process; 'source', '.', 'run xxx opt=nosep ', etc. It depends on the shell you are using, not the language.

----
I Go Back to Sleep, Now.

OGB

  • Comment on Re: Keeping environment variables after perl has exited

Replies are listed 'Best First'.
Re: Keeping environment variables after perl has exited
by Abigail-II (Bishop) on Feb 19, 2004 at 16:31 UTC
    sourcing a script means "run this script in the current shell". Which, unless your shell knows how to parse and execute Perl, isn't going to work for a Perl program:
    $ tcsh $ echo 'print "Hello, world\n"' > ppp $ source ppp $ print: Command not found.
    Abigail
      Yep, that's what I thought. I was just hoping for a different answer.

      Sandy