Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Perl (https://www.askmehelpdesk.com/forumdisplay.php?f=453)
-   -   Environment varibles after perl program ends (https://www.askmehelpdesk.com/showthread.php?t=82185)

  • Apr 13, 2007, 06:52 AM
    sfbattles
    environment varibles after perl program ends
    Is it possible to save the environment variable that Perl modified after the Perl program ends.
    example
    I want to use the PATH that my Perl script set as my unix PATH.



    Can this be done?
  • Apr 16, 2007, 07:37 PM
    asterisk_man
    I don't claim to be a perl expert but I can't think of a way to do this. When perl closes it's environment and memory is discarded. If you had perl output the values you wish to use you could capture them and set them external to the perl script but this may be messy. For things like ksh or bash you would do this like:

    . ScriptWhichSetsPath

    But I am pretty sure this won't work for a perl script. ScriptWhichSetsPath is read line by line and executed in the current shell.

    If you want to try to output the result and handle it in the script that called the perl code let me know and I can try to help you with that.

  • All times are GMT -7. The time now is 01:28 AM.