Sunday, July 10, 2011

adding a path to the environment

Perl Script:

#ENV is a hash in perl.
#You can access as it a simple hash
#For instance to add a path in the environment variable PATH in the OS execute the following program:


$ENV{'PATH'} = "G:\\perl_programs;"."$ENV{'PATH'}";
print "$ENV{'PATH'}";

OUTPUT:

G:\perl_programs>perl env_path.pl
G:\perl_programs;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Prog
ram Files\QuickTime\QTSystem\;C:\strawberry\c\bin;C:\strawberry\perl\site\bin;C:
\strawberry\perl\bin
G:\perl_programs>

No comments:

Post a Comment