gautham has asked for the wisdom of the Perl Monks concerning the following question:

hi everyone i am new to perl and i need some help to change the environment variable PATH to be changed by a perl script from which has an input through file.

Replies are listed 'Best First'.
Re: Changing an environment variable
by cdarke (Prior) on May 17, 2009 at 13:47 UTC
    You do not say which operating system, so:
    use warnings; use strict; my $sep = $^O eq 'MSWin32'?';':':'; $ENV{'PATH'} .= $sep . "directory to be added";
    Note: this will only affect processes that the Perl script itself starts, using, for example, system or qx, it will not affect any others.

    You do not make clear what PATH has to do with its input file. Is the inout file a script you are running?
Re: Changing an environment variable
by bradcathey (Prior) on May 17, 2009 at 12:37 UTC

    1) Show us what you are trying to do

    2) Show us the code you have already

    —Brad
    "The important work of moving the world forward does not wait to be done by perfect men." George Eliot